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,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 com.tridium.platform;
import javax.baja.sys.BFrozenEnum;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public final class BEngineWatchdogPolicy
extends BFrozenEnum {
public static final int LOG_ONLY = 1;
public static final int TERMINATE = 2;
public static final int REBOOT = 3;
public static final BEngineWatchdogPolicy logOnly = new BEngineWatchdogPolicy(1);
public static final BEngineWatchdogPolicy terminate = new BEngineWatchdogPolicy(2);
public static final BEngineWatchdogPolicy reboot = new BEngineWatchdogPolicy(3);
public static final Type TYPE;
public static final BEngineWatchdogPolicy DEFAULT;
static /* synthetic */ Class class$com$tridium$platform$BEngineWatchdogPolicy;
public final Type getType() {
return TYPE;
}
public static final BEngineWatchdogPolicy make(int n) {
return (BEngineWatchdogPolicy)logOnly.getRange().get(n, false);
}
public static final BEngineWatchdogPolicy make(String string) {
return (BEngineWatchdogPolicy)logOnly.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 BEngineWatchdogPolicy(int n) {
super(n);
}
static {
Class clazz = class$com$tridium$platform$BEngineWatchdogPolicy;
if (clazz == null) {
clazz = class$com$tridium$platform$BEngineWatchdogPolicy = BEngineWatchdogPolicy.class("[Lcom.tridium.platform.BEngineWatchdogPolicy;", false);
}
TYPE = Sys.loadType((Class)clazz);
DEFAULT = logOnly;
}
}
@@ -0,0 +1,133 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.sys.BComponent
* javax.baja.sys.Property
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform;
import javax.baja.sys.BComponent;
import javax.baja.sys.Property;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BFilesystemAttributes
extends BComponent {
public static final Property totalSpace = BFilesystemAttributes.newProperty((int)3, (int)-1, null);
public static final Property freeSpace = BFilesystemAttributes.newProperty((int)3, (int)-1, null);
public static final Property blockSize = BFilesystemAttributes.newProperty((int)3, (int)-1, null);
public static final Property currentFileCount = BFilesystemAttributes.newProperty((int)3, (int)-1, null);
public static final Property maxFileCount = BFilesystemAttributes.newProperty((int)3, (int)-1, null);
public static final Property isFlash = BFilesystemAttributes.newProperty((int)3, (boolean)false, null);
public static final Property isRamDisk = BFilesystemAttributes.newProperty((int)3, (boolean)false, null);
public static final Type TYPE;
static /* synthetic */ Class class$com$tridium$platform$BFilesystemAttributes;
public long getTotalSpace() {
return this.getLong(totalSpace);
}
public void setTotalSpace(long l) {
this.setLong(totalSpace, l, null);
}
public long getFreeSpace() {
return this.getLong(freeSpace);
}
public void setFreeSpace(long l) {
this.setLong(freeSpace, l, null);
}
public int getBlockSize() {
return this.getInt(blockSize);
}
public void setBlockSize(int n) {
this.setInt(blockSize, n, null);
}
public long getCurrentFileCount() {
return this.getLong(currentFileCount);
}
public void setCurrentFileCount(long l) {
this.setLong(currentFileCount, l, null);
}
public long getMaxFileCount() {
return this.getLong(maxFileCount);
}
public void setMaxFileCount(long l) {
this.setLong(maxFileCount, l, null);
}
public boolean getIsFlash() {
return this.getBoolean(isFlash);
}
public void setIsFlash(boolean bl) {
this.setBoolean(isFlash, bl, null);
}
public boolean getIsRamDisk() {
return this.getBoolean(isRamDisk);
}
public void setIsRamDisk(boolean bl) {
this.setBoolean(isRamDisk, bl, 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 BFilesystemAttributes() {
}
public BFilesystemAttributes(long l, long l2, int n) {
this(l, l2, n, -1, -1, false);
}
public BFilesystemAttributes(long l, long l2, int n, boolean bl) {
this(l, l2, n, -1, -1, bl);
}
public BFilesystemAttributes(long l, long l2, int n, long l3, long l4, boolean bl) {
this.setTotalSpace(l);
this.setFreeSpace(l2);
this.setBlockSize(n);
this.setIsFlash(bl);
this.setMaxFileCount(l3);
this.setCurrentFileCount(l4);
}
static {
Class clazz = class$com$tridium$platform$BFilesystemAttributes;
if (clazz == null) {
clazz = class$com$tridium$platform$BFilesystemAttributes = BFilesystemAttributes.class("[Lcom.tridium.platform.BFilesystemAttributes;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,99 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.sys.BFrozenEnum
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform;
import javax.baja.sys.BFrozenEnum;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public final class BOperatingSystemEnum
extends BFrozenEnum {
public static final int UNKNOWN = -1;
public static final int WINDOWS = 0;
public static final int QNX = 1;
public static final int LINUX = 2;
public static final int UNSUPPORTED = 3;
public static final BOperatingSystemEnum unknown = new BOperatingSystemEnum(-1);
public static final BOperatingSystemEnum windows = new BOperatingSystemEnum(0);
public static final BOperatingSystemEnum qnx = new BOperatingSystemEnum(1);
public static final BOperatingSystemEnum linux = new BOperatingSystemEnum(2);
public static final BOperatingSystemEnum unsupported = new BOperatingSystemEnum(3);
public static final Type TYPE;
public static final BOperatingSystemEnum DEFAULT;
private static BOperatingSystemEnum os;
static /* synthetic */ Class class$com$tridium$platform$BOperatingSystemEnum;
public final Type getType() {
return TYPE;
}
public static final BOperatingSystemEnum make(int n) {
return (BOperatingSystemEnum)unknown.getRange().get(n, false);
}
public static final BOperatingSystemEnum make(String string) {
return (BOperatingSystemEnum)unknown.getRange().get(string);
}
public static final BOperatingSystemEnum getOS() {
if (os == null) {
BOperatingSystemEnum.checkOS();
}
return os;
}
public static final boolean isOS(BOperatingSystemEnum bOperatingSystemEnum) {
if (os == null) {
BOperatingSystemEnum.checkOS();
}
boolean bl = false;
if (bOperatingSystemEnum == os) {
bl = true;
}
return bl;
}
private static final void checkOS() {
if (os == null) {
String string = System.getProperty("os.name");
os = string.toLowerCase().startsWith("l") && string.toLowerCase().endsWith("x") ? linux : (string.toLowerCase().startsWith("win") ? windows : (string.toLowerCase().startsWith("q") && string.toLowerCase().endsWith("x") ? qnx : unsupported));
}
}
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 BOperatingSystemEnum(int n) {
super(n);
}
static {
Class clazz = class$com$tridium$platform$BOperatingSystemEnum;
if (clazz == null) {
clazz = class$com$tridium$platform$BOperatingSystemEnum = BOperatingSystemEnum.class("[Lcom.tridium.platform.BOperatingSystemEnum;", false);
}
TYPE = Sys.loadType((Class)clazz);
DEFAULT = unknown;
os = null;
}
}
@@ -0,0 +1,462 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.sys.BIPlatform
* com.tridium.sys.Nre
* com.tridium.sys.module.NModule
* com.tridium.sys.resource.ResourceReport
* javax.baja.data.BIDataValue
* javax.baja.io.ValueDocDecoder
* javax.baja.io.ValueDocDecoder$BogTypeResolver
* javax.baja.io.ValueDocDecoder$ITypeResolver
* javax.baja.license.FeatureNotLicensedException
* javax.baja.license.LicenseDatabaseException
* javax.baja.log.Log
* javax.baja.naming.SlotPath
* javax.baja.registry.TypeInfo
* javax.baja.security.AuthenticationException
* javax.baja.sys.BBoolean
* javax.baja.sys.BComplex
* javax.baja.sys.BFacets
* javax.baja.sys.BModule
* javax.baja.sys.BObject
* javax.baja.sys.BValue
* javax.baja.sys.BVector
* javax.baja.sys.BajaRuntimeException
* javax.baja.sys.Context
* javax.baja.sys.ModuleNotFoundException
* javax.baja.sys.Property
* javax.baja.sys.ServiceNotFoundException
* javax.baja.sys.Slot
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.sys.TypeNotFoundException
* javax.baja.util.BServiceContainer
* javax.baja.xml.XException
*/
package com.tridium.platform;
import com.tridium.platform.BFilesystemAttributes;
import com.tridium.platform.BOperatingSystemEnum;
import com.tridium.platform.BPlatformService;
import com.tridium.platform.BPlatformServiceContainer;
import com.tridium.platform.BSystemPlatformService;
import com.tridium.platform.daemon.LocalSessionUtil;
import com.tridium.platform.daemon.message.ReportStatusMessage;
import com.tridium.platform.tcpip.BTcpIpPlatformService;
import com.tridium.sys.BIPlatform;
import com.tridium.sys.Nre;
import com.tridium.sys.module.NModule;
import com.tridium.sys.resource.ResourceReport;
import java.io.File;
import java.net.ConnectException;
import javax.baja.data.BIDataValue;
import javax.baja.io.ValueDocDecoder;
import javax.baja.license.FeatureNotLicensedException;
import javax.baja.license.LicenseDatabaseException;
import javax.baja.log.Log;
import javax.baja.naming.SlotPath;
import javax.baja.registry.TypeInfo;
import javax.baja.security.AuthenticationException;
import javax.baja.sys.BBoolean;
import javax.baja.sys.BComplex;
import javax.baja.sys.BFacets;
import javax.baja.sys.BModule;
import javax.baja.sys.BObject;
import javax.baja.sys.BValue;
import javax.baja.sys.BVector;
import javax.baja.sys.BajaRuntimeException;
import javax.baja.sys.Context;
import javax.baja.sys.ModuleNotFoundException;
import javax.baja.sys.Property;
import javax.baja.sys.ServiceNotFoundException;
import javax.baja.sys.Slot;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.sys.TypeNotFoundException;
import javax.baja.util.BServiceContainer;
import javax.baja.xml.XException;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BPlatform
extends BObject
implements BIPlatform {
public static final Type TYPE;
private static final PlatformTypeResolver typeResolver;
static final BFacets sysFacets;
public static Log log;
private int memoryUsage;
private int totalMemory;
private int cpuUsage;
private BSystemPlatformService sys;
static /* synthetic */ Class class$com$tridium$platform$BPlatform;
static /* synthetic */ Class class$com$tridium$platform$BPlatformService;
static /* synthetic */ Class class$com$tridium$platform$BFilesystemAttributes;
public Type getType() {
return TYPE;
}
public void initPlatform() throws Exception {
Object object;
File file = new File(Sys.getBajaHome(), "lib" + File.separator + "platform.bog");
if (!file.exists()) {
object = new File(Sys.getBajaHome(), "lib" + File.separator + "platform.bog.working");
if (((File)object).exists()) {
((File)object).renameTo(file);
} else {
throw new BajaRuntimeException("!lib/platform.bog file does not exist, can not load platform");
}
}
if (file.length() == 0L) {
throw new BajaRuntimeException("!lib/platform.bog file is empty, can not load platform");
}
object = new ValueDocDecoder(file);
object.setTypeResolver((ValueDocDecoder.ITypeResolver)typeResolver);
BPlatformServiceContainer bPlatformServiceContainer = (BPlatformServiceContainer)object.decodeDocument();
bPlatformServiceContainer.clearHandles();
BServiceContainer bServiceContainer = null;
try {
bServiceContainer = (BServiceContainer)Sys.getService((Type)BServiceContainer.TYPE);
}
catch (ServiceNotFoundException serviceNotFoundException) {
bServiceContainer = new BServiceContainer();
Sys.getStation().add(null, (BValue)bServiceContainer);
}
bServiceContainer.add("PlatformServices", (BValue)bPlatformServiceContainer, 3);
TypeInfo[] typeInfoArray = Sys.getRegistry().getConcreteTypes(BPlatformService.TYPE.getTypeInfo());
Class clazz = class$com$tridium$platform$BPlatformService;
if (clazz == null) {
clazz = class$com$tridium$platform$BPlatformService = BPlatform.class("[Lcom.tridium.platform.BPlatformService;", false);
}
BPlatformService[] bPlatformServiceArray = (BPlatformService[])bPlatformServiceContainer.getChildren(clazz);
int n = 0;
while (n < typeInfoArray.length) {
block24: {
BPlatformService bPlatformService;
boolean bl = false;
int n2 = 0;
while (n2 < bPlatformServiceArray.length) {
if (bPlatformServiceArray[n2].getType().getTypeInfo().equals(typeInfoArray[n])) {
bl = true;
}
++n2;
}
if (!bl && (bPlatformService = (BPlatformService)typeInfoArray[n].getInstance()).isValidPlatform()) {
String string = bPlatformService.getLicenseFeature();
String string2 = bPlatformService.getLicenseVendor();
if (string != null) {
try {
Sys.getLicenseManager().checkFeature(string2, string);
}
catch (FeatureNotLicensedException featureNotLicensedException) {
if (BOperatingSystemEnum.isOS(BOperatingSystemEnum.qnx)) {
log.warning("Platform Service " + (Object)((Object)bPlatformService) + " will not be added, feature \"" + string + "\" is not licensed");
}
break block24;
}
catch (LicenseDatabaseException licenseDatabaseException) {
break block24;
}
}
bPlatformServiceContainer.add(typeInfoArray[n].getTypeName(), (BValue)bPlatformService, bPlatformService.getSlotFlags());
}
}
++n;
}
Class clazz2 = class$com$tridium$platform$BPlatformService;
if (clazz2 == null) {
clazz2 = class$com$tridium$platform$BPlatformService = BPlatform.class("[Lcom.tridium.platform.BPlatformService;", false);
}
bPlatformServiceArray = (BPlatformService[])bPlatformServiceContainer.getChildren(clazz2);
try {
BModule bModule = Sys.loadModule((String)"platJennic");
Class clazz3 = bModule.loadClass("com.tridium.platJennic.BJennicPlatformService");
int n3 = 0;
while (n3 < bPlatformServiceArray.length) {
if (bPlatformServiceArray[n3] != null && clazz3.isInstance((Object)bPlatformServiceArray[n3])) {
log.warning("Removing platform service " + (Object)((Object)bPlatformServiceArray[n3]) + ", service is obsolete");
bPlatformServiceContainer.remove((BComplex)bPlatformServiceArray[n3]);
bPlatformServiceArray[n3] = null;
}
++n3;
}
}
catch (ClassNotFoundException classNotFoundException) {
}
catch (ModuleNotFoundException moduleNotFoundException) {}
int n4 = 0;
while (n4 < bPlatformServiceArray.length) {
if (bPlatformServiceArray[n4] != null) {
bPlatformServiceArray[n4].fw(1001, bServiceContainer, null, null, null);
}
++n4;
}
this.sys = (BSystemPlatformService)Sys.getService((Type)BSystemPlatformService.TYPE);
}
public BSystemPlatformService sys() {
if (this.sys == null || this.sys.getParent() == null) {
this.sys = (BSystemPlatformService)Sys.getService((Type)BSystemPlatformService.TYPE);
}
return this.sys;
}
public void stationStarted() {
BPlatformServiceContainer bPlatformServiceContainer = (BPlatformServiceContainer)Sys.getService((Type)BPlatformServiceContainer.TYPE);
Class clazz = class$com$tridium$platform$BPlatformService;
if (clazz == null) {
clazz = class$com$tridium$platform$BPlatformService = BPlatform.class("[Lcom.tridium.platform.BPlatformService;", false);
}
BPlatformService[] bPlatformServiceArray = (BPlatformService[])bPlatformServiceContainer.getChildren(clazz);
int n = 0;
while (n < bPlatformServiceArray.length) {
Property property;
try {
bPlatformServiceArray[n].doStationStarted(Sys.getStation());
}
catch (Throwable throwable) {
throwable.printStackTrace();
}
if (bPlatformServiceArray[n] instanceof BTcpIpPlatformService) {
property = bPlatformServiceArray[n].getPropertyInParent();
bPlatformServiceContainer.setFlags((Slot)property, bPlatformServiceContainer.getFlags((Slot)property) & 0xFFFFFFFB);
} else if (bPlatformServiceArray[n] instanceof BSystemPlatformService) {
property = bPlatformServiceArray[n].getPropertyInParent();
bPlatformServiceContainer.setFlags((Slot)property, bPlatformServiceContainer.getFlags((Slot)property) & 0xFFFFFFFB);
}
++n;
}
}
public boolean isFlashFileSystem() {
try {
BSystemPlatformService bSystemPlatformService = this.sys();
bSystemPlatformService.checkPropertiesLoaded();
BVector bVector = bSystemPlatformService.getFilesystemAttributes();
Class clazz = class$com$tridium$platform$BFilesystemAttributes;
if (clazz == null) {
clazz = class$com$tridium$platform$BFilesystemAttributes = BPlatform.class("[Lcom.tridium.platform.BFilesystemAttributes;", false);
}
BFilesystemAttributes[] bFilesystemAttributesArray = (BFilesystemAttributes[])bVector.getChildren(clazz);
return bFilesystemAttributesArray[0].getIsFlash();
}
catch (ServiceNotFoundException serviceNotFoundException) {
return false;
}
}
public boolean isFlashFileSystem(String string) {
try {
BSystemPlatformService bSystemPlatformService = this.sys();
bSystemPlatformService.checkPropertiesLoaded();
BFilesystemAttributes bFilesystemAttributes = (BFilesystemAttributes)bSystemPlatformService.getFilesystemAttributes().get(SlotPath.escape((String)string));
if (bFilesystemAttributes == null) {
throw new BajaRuntimeException(string + " filesystem does not exist");
}
return bFilesystemAttributes.getIsFlash();
}
catch (ServiceNotFoundException serviceNotFoundException) {
return false;
}
}
public boolean isStationAutoSaveEnabled() {
try {
BSystemPlatformService bSystemPlatformService = this.sys();
return bSystemPlatformService.getIsStationAutoSaveEnabled();
}
catch (ServiceNotFoundException serviceNotFoundException) {
return true;
}
}
public long getStationAutoSaveFrequency() {
try {
BSystemPlatformService bSystemPlatformService = this.sys();
return bSystemPlatformService.getStationAutoSaveFrequency().getMillis();
}
catch (ServiceNotFoundException serviceNotFoundException) {
return 3600000L;
}
}
public int getStationSaveBackupCount() {
try {
BSystemPlatformService bSystemPlatformService = this.sys();
return bSystemPlatformService.getStationSaveBackupCount();
}
catch (ServiceNotFoundException serviceNotFoundException) {
return 3;
}
}
public void poll() {
try {
BSystemPlatformService bSystemPlatformService = this.sys();
bSystemPlatformService.checkPropertiesLoaded();
bSystemPlatformService.invoke(BSystemPlatformService.poll, null, (Context)sysFacets);
int n = bSystemPlatformService.getCurrentCpuUsage();
this.cpuUsage = n < 0 ? 0 : n / bSystemPlatformService.getNumCpus();
int n2 = bSystemPlatformService.getTotalPhysicalMemory();
if (n2 > 0) {
this.totalMemory = n2;
int n3 = bSystemPlatformService.getFreePhysicalMemory();
this.memoryUsage = n3 >= 0 ? n2 - n3 : 0;
} else {
this.totalMemory = 0;
}
}
catch (ServiceNotFoundException serviceNotFoundException) {
this.memoryUsage = 0;
this.totalMemory = 0;
this.cpuUsage = 0;
}
}
public int getMemoryUsage() {
return this.memoryUsage;
}
public int getTotalMemory() {
return this.totalMemory;
}
public int getCpuUsage() {
return this.cpuUsage;
}
public String checkForStationFault() {
String string;
BSystemPlatformService bSystemPlatformService = this.sys();
String string2 = bSystemPlatformService.checkForStationFault();
if (string2 != null) {
return string2;
}
if (Nre.serviceManager.getActiveDataRecoveryService() != null && (string = Nre.serviceManager.getActiveDataRecoveryService().checkForStationFault()) != null) {
return string;
}
return null;
}
public void queryResources(ResourceReport resourceReport) {
this.sys.queryResources(resourceReport);
}
public void reportSummaryFields(String[] stringArray, String[] stringArray2) {
if (LocalSessionUtil.localDaemonIsAvailable()) {
try {
LocalSessionUtil.getLocalSession().sendMessage(new ReportStatusMessage(stringArray, stringArray2));
}
catch (ConnectException connectException) {
}
catch (AuthenticationException authenticationException) {}
}
}
public void resetLocalDaemonSession() {
LocalSessionUtil.resetLocalSession();
}
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.memoryUsage = 0;
this.totalMemory = 0;
this.cpuUsage = 0;
}
public BPlatform() {
this.this();
}
static {
Class clazz = class$com$tridium$platform$BPlatform;
if (clazz == null) {
clazz = class$com$tridium$platform$BPlatform = BPlatform.class("[Lcom.tridium.platform.BPlatform;", false);
}
TYPE = Sys.loadType((Class)clazz);
typeResolver = new PlatformTypeResolver();
sysFacets = BFacets.make((String[])new String[]{"resourceOnly"}, (BIDataValue[])new BBoolean[]{BBoolean.TRUE});
log = Log.getLog((String)"platform");
}
private static final class PlatformTypeResolver
extends ValueDocDecoder.BogTypeResolver {
public final BModule loadModule(ValueDocDecoder valueDocDecoder, BComplex bComplex, String string, String string2, String string3) {
try {
int n = string2.indexOf(61);
String string4 = string2.substring(0, n).trim();
String string5 = string2.substring(n + 1).trim();
if (string2.equals("platJennic=platJennic")) {
log.warning("Ignoring platJennic based type '" + string3 + "' in platform.bog.");
return null;
}
NModule nModule = Nre.moduleManager.loadModule(string5);
this.getModuleMap(valueDocDecoder).put(string4, nModule);
return nModule.bmodule();
}
catch (ModuleNotFoundException moduleNotFoundException) {
log.warning("Ignoring platform service '" + string3 + "' in platform.bog, required module not found!");
return null;
}
catch (Exception exception) {
throw new XException("Invalid module attribute '" + string2 + '\'');
}
}
public final BValue newInstance(ValueDocDecoder valueDocDecoder, BComplex bComplex, String string, Property property, String string2) {
if (string2 == null) {
if (property != null) {
return property.getDefaultValue();
}
log.warning("Missing frozen property: " + string);
return null;
}
try {
int n = string2.indexOf(58);
if (n <= 0) {
log.warning("Invalid typespec '" + string2 + '\'');
return null;
}
String string3 = string2.substring(0, n);
String string4 = string2.substring(n + 1);
NModule nModule = (NModule)this.getModuleMap(valueDocDecoder).get(string3);
if (nModule == null) {
return null;
}
Type type = nModule.getType(string4);
return (BValue)type.getInstance();
}
catch (XException xException) {
throw xException;
}
catch (TypeNotFoundException typeNotFoundException) {
log.warning("Type \"" + typeNotFoundException.getMessage() + "\" not found: " + string);
return null;
}
catch (Throwable throwable) {
log.warning("Cannot instantiate type '" + string2 + '\'', throwable);
return null;
}
}
private PlatformTypeResolver() {
}
}
}
@@ -0,0 +1,208 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.log.Log
* javax.baja.security.crypto.BTlsEnum
* javax.baja.sys.BComponent
* javax.baja.sys.BValue
* javax.baja.sys.InvalidEnumException
* javax.baja.sys.Property
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.xml.XElem
*/
package com.tridium.platform;
import java.util.ArrayList;
import java.util.List;
import javax.baja.log.Log;
import javax.baja.security.crypto.BTlsEnum;
import javax.baja.sys.BComponent;
import javax.baja.sys.BValue;
import javax.baja.sys.InvalidEnumException;
import javax.baja.sys.Property;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.xml.XElem;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BPlatformSSLSettings
extends BComponent {
public static final int DEFAULT_SSL_PORT = 5011;
public static final Property sslLicensed = BPlatformSSLSettings.newProperty((int)3, (boolean)false, null);
public static final Property sslEnabled = BPlatformSSLSettings.newProperty((int)3, (boolean)false, null);
public static final Property sslOnly = BPlatformSSLSettings.newProperty((int)3, (boolean)false, null);
public static final Property sslPort = BPlatformSSLSettings.newProperty((int)3, (int)5011, null);
public static final Property keyAlias = BPlatformSSLSettings.newProperty((int)3, (String)"tridium", null);
public static final Property sslAlgType = BPlatformSSLSettings.newProperty((int)3, (BValue)BTlsEnum.DEFAULT, null);
public static final Property fipsMode = BPlatformSSLSettings.newProperty((int)3, (boolean)false, null);
public static final Property supportsTlsMinProtocol = BPlatformSSLSettings.newProperty((int)3, (boolean)false, null);
public static final Type TYPE;
public static Log log;
private List aliases;
static /* synthetic */ Class class$com$tridium$platform$BPlatformSSLSettings;
public boolean getSslLicensed() {
return this.getBoolean(sslLicensed);
}
public void setSslLicensed(boolean bl) {
this.setBoolean(sslLicensed, bl, null);
}
public boolean getSslEnabled() {
return this.getBoolean(sslEnabled);
}
public void setSslEnabled(boolean bl) {
this.setBoolean(sslEnabled, bl, null);
}
public boolean getSslOnly() {
return this.getBoolean(sslOnly);
}
public void setSslOnly(boolean bl) {
this.setBoolean(sslOnly, bl, null);
}
public int getSslPort() {
return this.getInt(sslPort);
}
public void setSslPort(int n) {
this.setInt(sslPort, n, null);
}
public String getKeyAlias() {
return this.getString(keyAlias);
}
public void setKeyAlias(String string) {
this.setString(keyAlias, string, null);
}
public BTlsEnum getSslAlgType() {
return (BTlsEnum)this.get(sslAlgType);
}
public void setSslAlgType(BTlsEnum bTlsEnum) {
this.set(sslAlgType, (BValue)bTlsEnum, null);
}
public boolean getFipsMode() {
return this.getBoolean(fipsMode);
}
public void setFipsMode(boolean bl) {
this.setBoolean(fipsMode, bl, null);
}
public boolean getSupportsTlsMinProtocol() {
return this.getBoolean(supportsTlsMinProtocol);
}
public void setSupportsTlsMinProtocol(boolean bl) {
this.setBoolean(supportsTlsMinProtocol, bl, null);
}
public Type getType() {
return TYPE;
}
public void updateFromXml(XElem xElem) {
BTlsEnum bTlsEnum;
this.setSslLicensed(this.getB(xElem, "sslLicensed", "true"));
this.setSslEnabled(this.getB(xElem, "sslEnabled"));
this.setSslOnly(this.getB(xElem, "sslOnly"));
this.setSslPort(xElem.geti("sslPort"));
this.setKeyAlias(xElem.get("keyAlias"));
this.setFipsMode(this.getB(xElem, "fipsMode", "false"));
this.setSupportsTlsMinProtocol(this.getB(xElem, "supportsTlsMinProtocol", "false"));
String string = xElem.get("sslAlgType");
if (string != null) {
string = string.toLowerCase();
}
try {
bTlsEnum = BTlsEnum.make((String)string);
}
catch (InvalidEnumException invalidEnumException) {
log.trace("Unrecognized platform TLS protocol: " + string + ", defaulting to " + BTlsEnum.DEFAULT.getTag());
bTlsEnum = BTlsEnum.DEFAULT;
}
this.setSslAlgType(bTlsEnum);
}
public List getAliases() {
return this.aliases;
}
public void setAliases(List list) {
this.aliases = list;
}
private final boolean getB(XElem xElem, String string) {
return this.getB(xElem, string, "false");
}
private final boolean getB(XElem xElem, String string, String string2) {
return Boolean.valueOf(xElem.get(string, string2));
}
public void loadAliases(XElem xElem) {
XElem[] xElemArray = xElem.elems("key");
ArrayList<String> arrayList = new ArrayList<String>(xElemArray.length);
int n = 0;
while (n < xElemArray.length) {
arrayList.add(xElemArray[n].get("alias"));
++n;
}
this.setAliases(arrayList);
}
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.aliases = null;
}
public BPlatformSSLSettings() {
this.this();
}
public BPlatformSSLSettings(BPlatformSSLSettings bPlatformSSLSettings) {
this.this();
this.setSslEnabled(bPlatformSSLSettings.getSslEnabled());
this.setSslLicensed(bPlatformSSLSettings.getSslLicensed());
this.setSslOnly(bPlatformSSLSettings.getSslOnly());
this.setSslPort(bPlatformSSLSettings.getSslPort());
this.setKeyAlias(bPlatformSSLSettings.getKeyAlias());
this.setSslAlgType(bPlatformSSLSettings.getSslAlgType());
this.setFipsMode(bPlatformSSLSettings.getFipsMode());
this.setSupportsTlsMinProtocol(bPlatformSSLSettings.getSupportsTlsMinProtocol());
}
static {
Class clazz = class$com$tridium$platform$BPlatformSSLSettings;
if (clazz == null) {
clazz = class$com$tridium$platform$BPlatformSSLSettings = BPlatformSSLSettings.class("[Lcom.tridium.platform.BPlatformSSLSettings;", false);
}
TYPE = Sys.loadType((Class)clazz);
log = Log.getLog((String)"platform");
}
}
@@ -0,0 +1,261 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.agent.AgentList
* javax.baja.file.FileUtil
* javax.baja.io.ValueDocEncoder
* javax.baja.sys.Action
* javax.baja.sys.BComponent
* javax.baja.sys.BIService
* javax.baja.sys.BRelTime
* javax.baja.sys.BStation
* javax.baja.sys.BValue
* javax.baja.sys.BajaRuntimeException
* javax.baja.sys.Clock
* javax.baja.sys.Clock$Ticket
* javax.baja.sys.Context
* javax.baja.sys.Property
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform;
import com.tridium.platform.BPlatformServiceContainer;
import java.io.File;
import javax.baja.agent.AgentList;
import javax.baja.file.FileUtil;
import javax.baja.io.ValueDocEncoder;
import javax.baja.sys.Action;
import javax.baja.sys.BComponent;
import javax.baja.sys.BIService;
import javax.baja.sys.BRelTime;
import javax.baja.sys.BStation;
import javax.baja.sys.BValue;
import javax.baja.sys.BajaRuntimeException;
import javax.baja.sys.Clock;
import javax.baja.sys.Context;
import javax.baja.sys.Property;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public abstract class BPlatformService
extends BComponent
implements BIService {
public static final Property platformServiceDescription = BPlatformService.newProperty((int)1, (String)"unknown", null);
public static final Action poll = BPlatformService.newAction((int)2048, null);
public static final Action checkPropertiesLoaded = BPlatformService.newAction((int)4, null);
public static final Action savePlatformServiceProperties = BPlatformService.newAction((int)4, null);
public static final Type TYPE;
protected boolean platformServicePropertiesLoaded;
protected boolean isProxy;
protected boolean isServiceStarted;
protected Clock.Ticket pollTicket;
static /* synthetic */ Class class$com$tridium$platform$BPlatformService;
public String getPlatformServiceDescription() {
return this.getString(platformServiceDescription);
}
public void setPlatformServiceDescription(String string) {
this.setString(platformServiceDescription, string, null);
}
public void poll() {
this.invoke(poll, null, null);
}
public void checkPropertiesLoaded() {
this.invoke(checkPropertiesLoaded, null, null);
}
public void savePlatformServiceProperties() {
this.invoke(savePlatformServiceProperties, null, null);
}
public Type getType() {
return TYPE;
}
public boolean isProxy() {
return this.isProxy;
}
public boolean isValidPlatform() {
return false;
}
public String getLicenseFeature() {
return null;
}
public String getLicenseVendor() {
return "Tridium";
}
public int getSlotFlags() {
return 4;
}
public void loadPlatformServiceProperties() {
}
public void doStationStarted(BStation bStation) {
}
protected boolean startPollTimerOnSubscribe() {
return false;
}
public BRelTime getPollFrequency() {
return BRelTime.DEFAULT;
}
public AgentList getAgents(Context context) {
try {
AgentList agentList = super.getAgents(context);
agentList.remove("workbench:PropertySheet");
return agentList;
}
catch (Exception exception) {
exception.printStackTrace();
if (exception instanceof RuntimeException) {
throw (RuntimeException)exception;
}
throw new BajaRuntimeException((Throwable)exception);
}
}
public void doPoll(Context context) {
if (!this.isRunning()) {
return;
}
this.checkPropertiesLoaded();
}
public final synchronized void doCheckPropertiesLoaded() {
if (!this.platformServicePropertiesLoaded) {
this.loadPlatformServiceProperties();
this.platformServicePropertiesLoaded = true;
}
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public void doSavePlatformServiceProperties() throws Exception {
if (!this.isRunning()) {
return;
}
BPlatformServiceContainer bPlatformServiceContainer = (BPlatformServiceContainer)Sys.getService((Type)BPlatformServiceContainer.TYPE);
BPlatformServiceContainer bPlatformServiceContainer2 = bPlatformServiceContainer;
synchronized (bPlatformServiceContainer2) {
File file = new File(Sys.getBajaHome(), "lib" + File.separator + "platform.bog.working");
File file2 = new File(Sys.getBajaHome(), "lib" + File.separator + "platform.bog");
ValueDocEncoder valueDocEncoder = new ValueDocEncoder(file);
valueDocEncoder.encodeDocument((BValue)bPlatformServiceContainer);
valueDocEncoder.close();
FileUtil.renameToBackup((File)file2, (int)1);
if (!file.renameTo(file2)) {
throw new BajaRuntimeException("platform.bog rename failed");
}
return;
}
}
public void serviceStarted() throws Exception {
this.isProxy = false;
this.isServiceStarted = true;
}
public void serviceStopped() throws Exception {
this.isServiceStarted = false;
}
public boolean isServiceStarted() {
return this.isServiceStarted;
}
public boolean isParentLegal(BComponent bComponent) {
return bComponent instanceof BPlatformServiceContainer;
}
public void subscribed() {
if (this.startPollTimerOnSubscribe()) {
this.startPollTimer();
} else {
this.poll();
}
super.subscribed();
}
public void unsubscribed() {
if (this.startPollTimerOnSubscribe()) {
this.stopPollTimer();
}
}
protected void startPollTimer() {
this.poll();
if (this.pollTicket == null && this.getPollFrequency().getMillis() > 0L && this.isRunning()) {
this.pollTicket = Clock.schedulePeriodically((BComponent)this, (BRelTime)this.getPollFrequency(), (Action)poll, null);
}
}
protected void stopPollTimer() {
if (this.pollTicket != null) {
this.pollTicket.cancel();
this.pollTicket = null;
}
}
public final String getNavDescription(Context context) {
if (this.getPlatformServiceDescription().equals("unknown")) {
return super.getNavDescription(context);
}
return this.getPlatformServiceDescription();
}
public boolean hasNavChildren() {
return false;
}
static /* synthetic */ Class class(String string, boolean bl) {
try {
Class<?> clazz = Class.forName(string);
if (!bl) {
clazz = clazz.getComponentType();
}
return clazz;
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
private final /* synthetic */ void this() {
this.platformServicePropertiesLoaded = false;
this.isProxy = true;
this.isServiceStarted = false;
this.pollTicket = null;
}
public BPlatformService() {
this.this();
}
static {
Class clazz = class$com$tridium$platform$BPlatformService;
if (clazz == null) {
clazz = class$com$tridium$platform$BPlatformService = BPlatformService.class("[Lcom.tridium.platform.BPlatformService;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,151 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.nav.BINavNode
* javax.baja.nre.util.Array
* javax.baja.sys.Action
* javax.baja.sys.BComponent
* javax.baja.sys.BFacets
* javax.baja.sys.BIService
* javax.baja.sys.BIcon
* javax.baja.sys.BString
* javax.baja.sys.BValue
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.util.BServiceContainer
*/
package com.tridium.platform;
import com.tridium.platform.BPlatformService;
import com.tridium.platform.BSystemPlatformService;
import javax.baja.nav.BINavNode;
import javax.baja.nre.util.Array;
import javax.baja.sys.Action;
import javax.baja.sys.BComponent;
import javax.baja.sys.BFacets;
import javax.baja.sys.BIService;
import javax.baja.sys.BIcon;
import javax.baja.sys.BString;
import javax.baja.sys.BValue;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.util.BServiceContainer;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BPlatformServiceContainer
extends BComponent
implements BIService {
public static final Action sendThreadDumpToConsole = BPlatformServiceContainer.newAction((int)0, null);
public static final Action requestGarbageCollection = BPlatformServiceContainer.newAction((int)0, null);
public static final Action restartStation = BPlatformServiceContainer.newAction((int)128, null);
public static final Action renameAndRestartStation = BPlatformServiceContainer.newAction((int)132, (BValue)BString.make((String)"newStationName"), (BFacets)BFacets.make((String)"validator", (String)"baja:StationNameValidator"));
public static final Type TYPE;
private static final BIcon icon;
static /* synthetic */ Class class$com$tridium$platform$BPlatformServiceContainer;
static /* synthetic */ Class class$javax$baja$nav$BINavNode;
public void sendThreadDumpToConsole() {
this.invoke(sendThreadDumpToConsole, null, null);
}
public void requestGarbageCollection() {
this.invoke(requestGarbageCollection, null, null);
}
public void restartStation() {
this.invoke(restartStation, null, null);
}
public void renameAndRestartStation(BString bString) {
this.invoke(renameAndRestartStation, (BValue)bString, null);
}
public Type getType() {
return TYPE;
}
public Type[] getServiceTypes() {
return new Type[]{TYPE};
}
public void serviceStarted() throws Exception {
}
public void serviceStopped() throws Exception {
}
public boolean isParentLegal(BComponent bComponent) {
return bComponent instanceof BServiceContainer;
}
public boolean isChildLegal(BComponent bComponent) {
return bComponent instanceof BPlatformService;
}
public void doSendThreadDumpToConsole() throws Exception {
BSystemPlatformService bSystemPlatformService = (BSystemPlatformService)Sys.getService((Type)BSystemPlatformService.TYPE);
bSystemPlatformService.sendThreadDumpToConsole();
}
public void doRequestGarbageCollection() throws Exception {
BSystemPlatformService bSystemPlatformService = (BSystemPlatformService)Sys.getService((Type)BSystemPlatformService.TYPE);
bSystemPlatformService.requestGarbageCollection();
}
public void doRestartStation() throws Exception {
BSystemPlatformService bSystemPlatformService = (BSystemPlatformService)Sys.getService((Type)BSystemPlatformService.TYPE);
bSystemPlatformService.restartStation();
}
public void doRenameAndRestartStation(BString bString) {
BSystemPlatformService bSystemPlatformService = (BSystemPlatformService)Sys.getService((Type)BSystemPlatformService.TYPE);
bSystemPlatformService.renameAndRestartStation(bString);
}
public BINavNode[] getNavChildren() {
Class clazz = class$javax$baja$nav$BINavNode;
if (clazz == null) {
clazz = class$javax$baja$nav$BINavNode = BPlatformServiceContainer.class("[Ljavax.baja.nav.BINavNode;", false);
}
Array array = new Array(clazz);
BINavNode[] bINavNodeArray = super.getNavChildren();
int n = 0;
while (n < bINavNodeArray.length) {
if (!(bINavNodeArray[n] instanceof BSystemPlatformService)) {
array.add((Object)bINavNodeArray[n]);
}
++n;
}
return (BINavNode[])array.trim();
}
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$com$tridium$platform$BPlatformServiceContainer;
if (clazz == null) {
clazz = class$com$tridium$platform$BPlatformServiceContainer = BPlatformServiceContainer.class("[Lcom.tridium.platform.BPlatformServiceContainer;", false);
}
TYPE = Sys.loadType((Class)clazz);
icon = BIcon.std((String)"platform.png");
}
}
@@ -0,0 +1,97 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.naming.BISession
* javax.baja.naming.BOrd
* javax.baja.naming.OrdQuery
* javax.baja.naming.ViewQuery
* javax.baja.nav.BNavContainer
* javax.baja.sys.BIcon
* javax.baja.sys.Context
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.util.Lexicon
*/
package com.tridium.platform;
import javax.baja.naming.BISession;
import javax.baja.naming.BOrd;
import javax.baja.naming.OrdQuery;
import javax.baja.naming.ViewQuery;
import javax.baja.nav.BNavContainer;
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;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BSessionNavNode
extends BNavContainer {
public static final Type TYPE;
private BISession session;
private Type viewType;
private Lexicon lexicon;
static /* synthetic */ Class class$com$tridium$platform$BSessionNavNode;
public Type getType() {
return TYPE;
}
public BISession getNavSession() {
return this.session;
}
public Type getViewType() {
return this.viewType;
}
public BOrd getNavOrd() {
return BOrd.make((BOrd)this.session.getNavOrd(), (OrdQuery)new ViewQuery(this.getViewType().toString()));
}
public BIcon getNavIcon() {
return this.viewType.getTypeInfo().getIcon(null);
}
public String getNavDisplayName(Context context) {
return this.viewType.getTypeInfo().getDisplayName(context);
}
public String getNavDescription(Context context) {
String string = this.lexicon.get(this.viewType.getTypeName() + ".viewDesc");
return string == null ? "" : 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());
}
}
public BSessionNavNode(BISession bISession, Type type) {
super(type.getModule().getLexicon().get(type.getTypeName() + ".navName", type.getTypeName()));
this.session = bISession;
this.lexicon = type.getModule().getLexicon();
this.viewType = type;
}
static {
Class clazz = class$com$tridium$platform$BSessionNavNode;
if (clazz == null) {
clazz = class$com$tridium$platform$BSessionNavNode = BSessionNavNode.class("[Lcom.tridium.platform.BSessionNavNode;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,134 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.agent.AgentFilter
* javax.baja.agent.AgentInfo
* javax.baja.agent.BIAgent
* javax.baja.naming.BISession
* javax.baja.nav.BINavNode
* javax.baja.nre.util.Array
* javax.baja.sys.BObject
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform;
import com.tridium.platform.BSessionNavNode;
import java.util.Comparator;
import javax.baja.agent.AgentFilter;
import javax.baja.agent.AgentInfo;
import javax.baja.agent.BIAgent;
import javax.baja.naming.BISession;
import javax.baja.nav.BINavNode;
import javax.baja.nre.util.Array;
import javax.baja.sys.BObject;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public abstract class BSessionNavNodeFactory
extends BObject
implements BIAgent {
public static final Type TYPE;
public static Comparator NAV_NODE_COMPARATOR;
private Array navNodes;
private BISession session;
static /* synthetic */ Class class$com$tridium$platform$BSessionNavNodeFactory;
public Type getType() {
return TYPE;
}
public static BSessionNavNodeFactory[] makeFor(BISession bISession) {
AgentInfo[] agentInfoArray = ((BObject)bISession).getAgents().filter(AgentFilter.is((Type)TYPE)).list();
Class clazz = class$com$tridium$platform$BSessionNavNodeFactory;
if (clazz == null) {
clazz = class$com$tridium$platform$BSessionNavNodeFactory = BSessionNavNodeFactory.class("[Lcom.tridium.platform.BSessionNavNodeFactory;", false);
}
Array array = new Array(clazz);
int n = 0;
while (n < agentInfoArray.length) {
if (!agentInfoArray[n].getAgentType().isAbstract() && !agentInfoArray[n].getAgentType().isInterface()) {
BSessionNavNodeFactory bSessionNavNodeFactory = (BSessionNavNodeFactory)agentInfoArray[n].getAgentType().getInstance();
bSessionNavNodeFactory.setNavSession(bISession);
array.add((Object)bSessionNavNodeFactory);
if (bISession.isConnected()) {
bSessionNavNodeFactory.connect();
}
}
++n;
}
return (BSessionNavNodeFactory[])array.trim();
}
public abstract void connect();
public void disconnect() {
}
public final Array getNavNodes() {
return this.navNodes;
}
public final BSessionNavNode getNavNode(String string) {
if (this.navNodes != null) {
int n = 0;
while (n < this.navNodes.size()) {
if (((BSessionNavNode)((Object)this.navNodes.get(n))).getNavName().equals(string)) {
return (BSessionNavNode)((Object)this.navNodes.get(n));
}
++n;
}
}
return null;
}
public void setNavSession(BISession bISession) {
this.session = bISession;
}
public final BISession getNavSession() {
return this.session;
}
protected final void setNavNodes(Array array) {
this.navNodes = array;
}
protected final void setNavNodes(BSessionNavNode[] bSessionNavNodeArray) {
this.setNavNodes(new Array((Object[])bSessionNavNodeArray));
}
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$com$tridium$platform$BSessionNavNodeFactory;
if (clazz == null) {
clazz = class$com$tridium$platform$BSessionNavNodeFactory = BSessionNavNodeFactory.class("[Lcom.tridium.platform.BSessionNavNodeFactory;", false);
}
TYPE = Sys.loadType((Class)clazz);
NAV_NODE_COMPARATOR = new Comparator(){
public final int compare(Object object, Object object2) {
BINavNode bINavNode = (BINavNode)object;
BINavNode bINavNode2 = (BINavNode)object2;
return bINavNode.getNavDisplayName(null).compareTo(bINavNode2.getNavDisplayName(null));
}
};
}
}
@@ -0,0 +1,96 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.job.BSimpleJob
* javax.baja.sys.Context
* javax.baja.sys.Property
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.LocalSessionUtil;
import com.tridium.platform.daemon.message.DeleteStationMessage;
import javax.baja.job.BSimpleJob;
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 BStationRenameCleanupJob
extends BSimpleJob {
public static final Property oldStationName = BStationRenameCleanupJob.newProperty((int)0, (String)"", null);
public static final Type TYPE;
static /* synthetic */ Class class$com$tridium$platform$BStationRenameCleanupJob;
public final String getOldStationName() {
return this.getString(oldStationName);
}
public final void setOldStationName(String string) {
this.setString(oldStationName, string, null);
}
public final Type getType() {
return TYPE;
}
public final void stationStarted() throws Exception {
new Thread(this.getType().toString()){
public final void run() {
try {
Thread.sleep(100L);
}
catch (Exception exception) {
exception.printStackTrace();
}
BStationRenameCleanupJob.this.getParent().asComponent().remove(BStationRenameCleanupJob.this.getName());
BStationRenameCleanupJob.this.submit(null);
}
}.start();
}
public final void run(Context context) throws Exception {
BDaemonSession bDaemonSession;
this.setProgress(50);
if (!Sys.getStation().getStationName().equals(this.getOldStationName())) {
bDaemonSession = LocalSessionUtil.getLocalSession();
if (bDaemonSession == null) {
throw new Exception("Could not rename Station. Please ensure Station is running from Platform!");
}
} else {
throw new Exception("Cannot rename station; station files must locked by another process.");
}
bDaemonSession.sendMessage(new DeleteStationMessage(this.getOldStationName()));
this.log().success("Station rename from " + this.getOldStationName() + " to " + Sys.getStation().getStationName() + " complete.");
this.setProgress(100);
}
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$com$tridium$platform$BStationRenameCleanupJob;
if (clazz == null) {
clazz = class$com$tridium$platform$BStationRenameCleanupJob = BStationRenameCleanupJob.class("[Lcom.tridium.platform.BStationRenameCleanupJob;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,45 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platform;
public interface IPlatformLibrary {
public String getLastErrorMessage();
public void log(int var1, String var2);
public String getNativeTimeZone();
public int setNativeTimeZone(String var1, int var2, int var3, int var4, int var5, int var6, int var7, int var8, int var9, int var10, int var11, int var12, int var13, int var14, int var15, int var16, int var17);
public int setSystemTime(long var1);
public String[] getAllFileSystemNames();
public long getFreeBytes(String var1);
public long getTotalBytes(String var1);
public int getBlockSize(String var1);
public long getMaxFileCount(String var1);
public long getCurrentFileCount(String var1);
public boolean isFlash(String var1);
public long getTotalPhysicalMemoryBytes();
public long getFreePhysicalMemoryBytes();
public int getCurrentCPUUtilization();
public int getOverallCPUUtilization();
public int getNumberCPUs();
public void updateWatchdog(String var1, int var2, int var3, int var4);
public long getProcessId();
}
@@ -0,0 +1,82 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.sys.Context
* javax.baja.sys.Localizable
* javax.baja.util.Lexicon
*/
package com.tridium.platform;
import java.net.ConnectException;
import java.text.MessageFormat;
import javax.baja.sys.Context;
import javax.baja.sys.Localizable;
import javax.baja.util.Lexicon;
public class LocalizableConnectException
extends ConnectException
implements Localizable {
private String lexiconModule;
private String lexiconKey;
private Object[] lexiconArgs;
public String getLexiconModule() {
return this.lexiconModule;
}
public String getLexiconKey() {
return this.lexiconKey;
}
public Object[] getLexiconArguments() {
return this.lexiconArgs;
}
public String toString(Context context) {
return LocalizableConnectException.format(this.lexiconModule, this.lexiconKey, this.lexiconArgs, context);
}
public static String format(String string, String string2, Object[] objectArray, Context context) {
try {
String string3 = Lexicon.make((String)string, (Context)context).get(string2, null);
if (string3 != null) {
return MessageFormat.format(string3, objectArray);
}
StringBuffer stringBuffer = new StringBuffer(string2);
if (objectArray != null) {
stringBuffer.append(" {");
int n = 0;
while (n < objectArray.length) {
if (n > 0) {
stringBuffer.append(", ");
}
stringBuffer.append(objectArray[n]);
++n;
}
stringBuffer.append(" }");
}
return stringBuffer.toString();
}
catch (Throwable throwable) {
throwable.printStackTrace();
return string2;
}
}
public LocalizableConnectException(String string, String string2, Object[] objectArray) {
super(LocalizableConnectException.format(string, string2, objectArray, null));
this.lexiconModule = string;
this.lexiconKey = string2;
this.lexiconArgs = objectArray;
}
public LocalizableConnectException(String string, String string2) {
this(string, string2, null);
}
public LocalizableConnectException(Lexicon lexicon, String string) {
this(lexicon.module.getModuleName(), string, null);
}
}
@@ -0,0 +1,201 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platform;
import com.tridium.platform.BPlatform;
import com.tridium.platform.IPlatformLibrary;
abstract class NativePlatformLibrary
implements IPlatformLibrary {
public static boolean nativesLoaded = false;
public static boolean errorPrinted = false;
private static Object NATIVE_FS_MONITOR = new Object();
public static synchronized boolean load() {
block3: {
if (!nativesLoaded) {
try {
System.loadLibrary("platform");
nativesLoaded = true;
errorPrinted = false;
}
catch (Throwable throwable) {
if (errorPrinted) break block3;
BPlatform.log.error("Cannot load native platform library");
errorPrinted = true;
}
}
}
return nativesLoaded;
}
public String getLastErrorMessage() {
return NativePlatformLibrary.getLastErrorMessage0();
}
public void log(int n, String string) {
NativePlatformLibrary.log0(n, string);
}
public int setSystemTime(long l) {
return NativePlatformLibrary.setSystemTime0(l);
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public String[] getAllFileSystemNames() {
Object object = NATIVE_FS_MONITOR;
synchronized (object) {
return NativePlatformLibrary.getAllFileSystemNames0();
}
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public long getFreeBytes(String string) {
Object object = NATIVE_FS_MONITOR;
synchronized (object) {
return NativePlatformLibrary.getFreeBytes0(string);
}
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public long getTotalBytes(String string) {
Object object = NATIVE_FS_MONITOR;
synchronized (object) {
return NativePlatformLibrary.getTotalBytes0(string);
}
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public int getBlockSize(String string) {
Object object = NATIVE_FS_MONITOR;
synchronized (object) {
return NativePlatformLibrary.getBlockSize0(string);
}
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public long getMaxFileCount(String string) {
Object object = NATIVE_FS_MONITOR;
synchronized (object) {
return NativePlatformLibrary.getMaxFileCount0(string);
}
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public long getCurrentFileCount(String string) {
Object object = NATIVE_FS_MONITOR;
synchronized (object) {
return NativePlatformLibrary.getCurrentFileCount0(string);
}
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public boolean isFlash(String string) {
Object object = NATIVE_FS_MONITOR;
synchronized (object) {
return NativePlatformLibrary.isFlash0(string);
}
}
public long getTotalPhysicalMemoryBytes() {
return NativePlatformLibrary.getTotalPhysicalMemoryBytes0();
}
public long getFreePhysicalMemoryBytes() {
return NativePlatformLibrary.getFreePhysicalMemoryBytes0();
}
public int getCurrentCPUUtilization() {
return NativePlatformLibrary.getCurrentCPUUtilization0();
}
public int getOverallCPUUtilization() {
return NativePlatformLibrary.getOverallCPUUtilization0();
}
public int getNumberCPUs() {
return NativePlatformLibrary.getNumberCPUs0();
}
public void updateWatchdog(String string, int n, int n2, int n3) {
NativePlatformLibrary.updateWatchdog0(string, n, n2, n3);
}
public long getProcessId() {
return NativePlatformLibrary.getProcessId0();
}
private static final native String getLastErrorMessage0();
private static final native void log0(int var0, String var1);
private static final native int setSystemTime0(long var0);
private static final native String[] getAllFileSystemNames0();
private static final native long getFreeBytes0(String var0);
private static final native long getTotalBytes0(String var0);
private static final native int getBlockSize0(String var0);
private static final native long getMaxFileCount0(String var0);
private static final native long getCurrentFileCount0(String var0);
private static final native boolean isFlash0(String var0);
private static final native long getTotalPhysicalMemoryBytes0();
private static final native long getFreePhysicalMemoryBytes0();
private static final native int getCurrentCPUUtilization0();
private static final native int getOverallCPUUtilization0();
private static final native int getNumberCPUs0();
private static final native void updateWatchdog0(String var0, int var1, int var2, int var3);
private static final native long getProcessId0();
NativePlatformLibrary() {
}
}
@@ -0,0 +1,42 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.nre.util.JavaTimeUtil
*/
package com.tridium.platform;
import com.tridium.nre.util.JavaTimeUtil;
import com.tridium.platform.NativePlatformLibrary;
public class NativePlatformLibraryNpsdk
extends NativePlatformLibrary {
public String getNativeTimeZone() {
String string = JavaTimeUtil.convertOlsonIdToTimeZoneXml((String)NativePlatformLibraryNpsdk.getNativeTimeZone0());
if (string == null) {
string = "<zone id=\"UTC\" utcOffset=\"0\"/>";
}
return string;
}
public int setNativeTimeZone(String string, int n, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int n9, int n10, int n11, int n12, int n13, int n14, int n15, int n16) {
return NativePlatformLibraryNpsdk.setNativeTimeZone0(string);
}
private static final native String getNativeTimeZone0();
private static final native int setNativeTimeZone0(String var0);
public String getAltArchivePath() {
return NativePlatformLibraryNpsdk.getAltArchivePath0();
}
public int getArchiveBackupCount() {
return NativePlatformLibraryNpsdk.getArchiveBackupCount0();
}
private static final native String getAltArchivePath0();
private static final native int getArchiveBackupCount0();
}
@@ -0,0 +1,22 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platform;
import com.tridium.platform.NativePlatformLibrary;
public class NativePlatformLibraryTridium
extends NativePlatformLibrary {
public String getNativeTimeZone() {
return NativePlatformLibraryTridium.getNativeTimeZone0();
}
public int setNativeTimeZone(String string, int n, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int n9, int n10, int n11, int n12, int n13, int n14, int n15, int n16) {
return NativePlatformLibraryTridium.setNativeTimeZone0(string, n, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14, n15, n16);
}
private static final native String getNativeTimeZone0();
private static final native int setNativeTimeZone0(String var0, int var1, int var2, int var3, int var4, int var5, int var6, int var7, int var8, int var9, int var10, int var11, int var12, int var13, int var14, int var15, int var16);
}
@@ -0,0 +1,43 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform;
import com.tridium.platform.BSystemPlatformService;
import com.tridium.platform.tcpip.PlatformTcpIpManager;
import com.tridium.platform.time.PlatformTimeManager;
import javax.baja.platform.LocalPlatform;
import javax.baja.platform.tcpip.TcpIpManager;
import javax.baja.platform.time.TimeManager;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
public class NiagaraLocalPlatform
extends LocalPlatform {
private PlatformTimeManager timeMgr = PlatformTimeManager.make();
private PlatformTcpIpManager tcpipMgr = PlatformTcpIpManager.make();
public static LocalPlatform make() {
return new NiagaraLocalPlatform();
}
public TcpIpManager getTcpIpManager() {
return this.tcpipMgr;
}
public TimeManager getTimeManager() {
return this.timeMgr;
}
public void restartNiagaraEnvironment() {
((BSystemPlatformService)Sys.getService((Type)BSystemPlatformService.TYPE)).restartStation();
}
private NiagaraLocalPlatform() {
}
}
@@ -0,0 +1,45 @@
/*
* 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 com.tridium.platform.alarm;
import com.tridium.platform.alarm.BPlatformServiceAlarmRecord;
import com.tridium.platform.alarm.PlatformServiceAlarmListener;
import javax.baja.sys.BBoolean;
import javax.baja.sys.BInterface;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
public interface BIAlarmablePlatformService
extends BInterface {
public static final Type TYPE;
public static final String MSG_TEXT = "msgText";
public static final String SOURCE_NAME = "sourceName";
public static final String HYPERLINK_ORD = "hyperlinkOrd";
public static final String SOUND_FILE = "soundFile";
public static final String ICON = "icon";
public static final String P_ALARM_TYPE = "alarmType";
public void addPlatformServiceAlarmListener(PlatformServiceAlarmListener var1);
public void removePlatformServiceAlarmListener(PlatformServiceAlarmListener var1);
public void firePlatformServiceAlarmEvent(BPlatformServiceAlarmRecord var1);
public BBoolean ackAlarm(BPlatformServiceAlarmRecord var1);
static {
Class clazz = 1.class$com$tridium$platform$alarm$BIAlarmablePlatformService;
if (clazz == null) {
clazz = 1.class$com$tridium$platform$alarm$BIAlarmablePlatformService = 1.class("[Lcom.tridium.platform.alarm.BIAlarmablePlatformService;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,106 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.sys.Action
* javax.baja.sys.BBoolean
* javax.baja.sys.BComponent
* javax.baja.sys.BValue
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform.alarm;
import com.tridium.platform.alarm.BIAlarmablePlatformService;
import com.tridium.platform.alarm.BPlatformAlarmSupport;
import com.tridium.platform.alarm.BPlatformServiceAlarmRecord;
import com.tridium.platform.alarm.PlatformServiceAlarmListener;
import java.util.Enumeration;
import java.util.Vector;
import javax.baja.sys.Action;
import javax.baja.sys.BBoolean;
import javax.baja.sys.BComponent;
import javax.baja.sys.BValue;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BPlatformAlarmProxy
extends BComponent
implements BIAlarmablePlatformService {
public static final Action ackAlarm = BPlatformAlarmProxy.newAction((int)0, (BValue)new BPlatformServiceAlarmRecord(), null);
public static final Type TYPE;
Vector alarmListeners;
BPlatformAlarmSupport alarmSupport;
static /* synthetic */ Class class$com$tridium$platform$alarm$BPlatformAlarmProxy;
public BBoolean ackAlarm(BPlatformServiceAlarmRecord bPlatformServiceAlarmRecord) {
return (BBoolean)this.invoke(ackAlarm, (BValue)bPlatformServiceAlarmRecord, null);
}
public Type getType() {
return TYPE;
}
public void setAlarmSupport(BPlatformAlarmSupport bPlatformAlarmSupport) {
this.alarmSupport = bPlatformAlarmSupport;
bPlatformAlarmSupport.setSourceComponent(this);
}
public void addPlatformServiceAlarmListener(PlatformServiceAlarmListener platformServiceAlarmListener) {
this.alarmListeners.add(platformServiceAlarmListener);
}
public void removePlatformServiceAlarmListener(PlatformServiceAlarmListener platformServiceAlarmListener) {
this.alarmListeners.remove(platformServiceAlarmListener);
}
public void firePlatformServiceAlarmEvent(BPlatformServiceAlarmRecord bPlatformServiceAlarmRecord) {
if (this.alarmListeners.size() == 0) {
return;
}
Enumeration enumeration = this.alarmListeners.elements();
while (enumeration.hasMoreElements()) {
PlatformServiceAlarmListener platformServiceAlarmListener = (PlatformServiceAlarmListener)enumeration.nextElement();
platformServiceAlarmListener.platformServiceAlarm(bPlatformServiceAlarmRecord);
}
}
public BBoolean doAckAlarm(BPlatformServiceAlarmRecord bPlatformServiceAlarmRecord) {
boolean bl = this.alarmSupport.ackAlarm(bPlatformServiceAlarmRecord);
return BBoolean.make((boolean)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 final /* synthetic */ void this() {
this.alarmListeners = new Vector(1);
this.alarmSupport = null;
}
public BPlatformAlarmProxy() {
this.this();
}
static {
Class clazz = class$com$tridium$platform$alarm$BPlatformAlarmProxy;
if (clazz == null) {
clazz = class$com$tridium$platform$alarm$BPlatformAlarmProxy = BPlatformAlarmProxy.class("[Lcom.tridium.platform.alarm.BPlatformAlarmProxy;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,288 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.data.BIDataValue
* javax.baja.naming.BOrd
* javax.baja.naming.OrdQuery
* javax.baja.sys.BAbsTime
* 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 com.tridium.platform.alarm;
import com.tridium.platform.alarm.BPlatformServiceAlarmRecord;
import com.tridium.platform.alarm.BPlatformServiceSourceState;
import java.util.HashMap;
import javax.baja.data.BIDataValue;
import javax.baja.naming.BOrd;
import javax.baja.naming.OrdQuery;
import javax.baja.sys.BAbsTime;
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 BPlatformAlarmSupport
extends BComponent {
public static final Property alarmClass = BPlatformAlarmSupport.newProperty((int)0, (String)"defaultAlarmClass", (BFacets)BFacets.make((String)"fieldEditor", (BIDataValue)BString.make((String)"alarm:AlarmClassFE")));
public static final Property sourceName = BPlatformAlarmSupport.newProperty((int)0, (BValue)BFormat.make((String)"%parent.displayName%"), null);
public static final Property alertText = BPlatformAlarmSupport.newProperty((int)0, (BValue)BFormat.make((String)""), null);
public static final Property toFaultText = BPlatformAlarmSupport.newProperty((int)0, (BValue)BFormat.make((String)""), null);
public static final Property toOffnormalText = BPlatformAlarmSupport.newProperty((int)0, (BValue)BFormat.make((String)""), null);
public static final Property toNormalText = BPlatformAlarmSupport.newProperty((int)0, (BValue)BFormat.make((String)""), null);
public static final Property hyperlinkOrd = BPlatformAlarmSupport.newProperty((int)0, (BValue)BOrd.NULL, (BFacets)BFacets.make((String)"ordRelativize", (boolean)false));
public static final Property soundFile = BPlatformAlarmSupport.newProperty((int)0, (BValue)BOrd.NULL, (BFacets)BFacets.make((String)"targetType", (BIDataValue)BString.make((String)"file:AudioFile")));
public static final Property alarmIcon = BPlatformAlarmSupport.newProperty((int)0, (BValue)BOrd.NULL, (BFacets)BFacets.make((String)"targetType", (BIDataValue)BString.make((String)"file:ImageFile")));
public static final Property metaData = BPlatformAlarmSupport.newProperty((int)0, (BValue)BFacets.DEFAULT, null);
public static final Type TYPE;
private static final BIcon icon;
BComponent comp;
BAbsTime lastAlertTime;
BAbsTime lastOffnormalTime;
BAbsTime lastFaultTime;
static /* synthetic */ Class class$com$tridium$platform$alarm$BPlatformAlarmSupport;
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 getAlertText() {
return (BFormat)this.get(alertText);
}
public void setAlertText(BFormat bFormat) {
this.set(alertText, (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 BFacets getMetaData() {
return (BFacets)this.get(metaData);
}
public void setMetaData(BFacets bFacets) {
this.set(metaData, (BValue)bFacets, null);
}
public Type getType() {
return TYPE;
}
public void setSourceComponent(BComponent bComponent) {
this.comp = bComponent;
}
public BPlatformServiceAlarmRecord makeNewAlert() {
return this.makeNewAlert(BFacets.NULL);
}
public BPlatformServiceAlarmRecord makeNewAlert(BFacets bFacets) {
return this.makeNewAlarm(BPlatformServiceSourceState.alert, bFacets);
}
public BPlatformServiceAlarmRecord makeNewOffnormalAlarm() {
return this.makeNewOffnormalAlarm(BFacets.NULL);
}
public BPlatformServiceAlarmRecord makeNewOffnormalAlarm(BFacets bFacets) {
return this.makeNewAlarm(BPlatformServiceSourceState.offnormal, bFacets);
}
public BPlatformServiceAlarmRecord makeNewFaultAlarm() {
return this.makeNewFaultAlarm(BFacets.NULL);
}
public BPlatformServiceAlarmRecord makeNewFaultAlarm(BFacets bFacets) {
return this.makeNewAlarm(BPlatformServiceSourceState.fault, bFacets);
}
private final BPlatformServiceAlarmRecord makeNewAlarm(BPlatformServiceSourceState bPlatformServiceSourceState, BFacets bFacets) {
BFacets bFacets2 = BFacets.make((BFacets)this.makeAlarmData(bPlatformServiceSourceState), (BFacets)bFacets);
BPlatformServiceAlarmRecord bPlatformServiceAlarmRecord = new BPlatformServiceAlarmRecord(BOrd.make((OrdQuery)this.comp.getSlotPath()), this.getAlarmClass(), bPlatformServiceSourceState, bFacets2);
if (bPlatformServiceSourceState == BPlatformServiceSourceState.offnormal) {
this.lastOffnormalTime = bPlatformServiceAlarmRecord.getTimestamp();
} else if (bPlatformServiceSourceState == BPlatformServiceSourceState.fault) {
this.lastFaultTime = bPlatformServiceAlarmRecord.getTimestamp();
} else if (bPlatformServiceSourceState == BPlatformServiceSourceState.alert) {
this.lastAlertTime = bPlatformServiceAlarmRecord.getTimestamp();
}
return bPlatformServiceAlarmRecord;
}
public BPlatformServiceAlarmRecord makeToNormal() {
return this.makeToNormal(BFacets.NULL);
}
public BPlatformServiceAlarmRecord makeToNormal(BFacets bFacets) {
return this.makeNewAlarm(BPlatformServiceSourceState.normal, bFacets);
}
public boolean ackAlarm(BPlatformServiceAlarmRecord bPlatformServiceAlarmRecord) {
boolean bl = false;
bPlatformServiceAlarmRecord.setAlarmClass(this.getAlarmClass());
if (bPlatformServiceAlarmRecord.getSourceState() == BPlatformServiceSourceState.offnormal) {
boolean bl2 = true;
if (this.lastOffnormalTime != null) {
bl2 = bPlatformServiceAlarmRecord.getTimestamp().equals((Object)this.lastOffnormalTime);
}
bl = bl2;
} else if (bPlatformServiceAlarmRecord.getSourceState() == BPlatformServiceSourceState.fault) {
boolean bl3 = true;
if (this.lastFaultTime != null) {
bl3 = bPlatformServiceAlarmRecord.getTimestamp().equals((Object)this.lastFaultTime);
}
bl = bl3;
} else if (bPlatformServiceAlarmRecord.getSourceState() == BPlatformServiceSourceState.alert) {
boolean bl4 = true;
if (this.lastAlertTime != null) {
bl4 = bPlatformServiceAlarmRecord.getTimestamp().equals((Object)this.lastAlertTime);
}
bl = bl4;
}
return bl;
}
public BFacets makeAlarmData(BPlatformServiceSourceState bPlatformServiceSourceState) {
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 (bPlatformServiceSourceState == BPlatformServiceSourceState.offnormal) {
string = this.getToOffnormalText().toString();
} else if (bPlatformServiceSourceState == BPlatformServiceSourceState.fault) {
string = this.getToFaultText().toString();
} else if (bPlatformServiceSourceState == BPlatformServiceSourceState.alert) {
string = this.getAlertText().toString();
} else if (bPlatformServiceSourceState == BPlatformServiceSourceState.normal) {
string = this.getToNormalText().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()));
}
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());
}
}
public BPlatformAlarmSupport() {
}
public BPlatformAlarmSupport(BComponent bComponent) {
this.comp = bComponent;
}
static {
Class clazz = class$com$tridium$platform$alarm$BPlatformAlarmSupport;
if (clazz == null) {
clazz = class$com$tridium$platform$alarm$BPlatformAlarmSupport = BPlatformAlarmSupport.class("[Lcom.tridium.platform.alarm.BPlatformAlarmSupport;", false);
}
TYPE = Sys.loadType((Class)clazz);
icon = BIcon.std((String)"alarm.png");
}
}
@@ -0,0 +1,128 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.naming.BOrd
* javax.baja.sys.BAbsTime
* javax.baja.sys.BFacets
* javax.baja.sys.BStruct
* javax.baja.sys.BValue
* javax.baja.sys.Property
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.util.BUuid
*/
package com.tridium.platform.alarm;
import com.tridium.platform.alarm.BPlatformServiceSourceState;
import javax.baja.naming.BOrd;
import javax.baja.sys.BAbsTime;
import javax.baja.sys.BFacets;
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;
import javax.baja.util.BUuid;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BPlatformServiceAlarmRecord
extends BStruct {
public static final Property uuid = BPlatformServiceAlarmRecord.newProperty((int)0, (BValue)BUuid.make(), null);
public static final Property source = BPlatformServiceAlarmRecord.newProperty((int)0, (BValue)BOrd.DEFAULT, null);
public static final Property alarmClass = BPlatformServiceAlarmRecord.newProperty((int)0, (String)"defaultAlarmClass", null);
public static final Property sourceState = BPlatformServiceAlarmRecord.newProperty((int)0, (BValue)BPlatformServiceSourceState.offnormal, null);
public static final Property timestamp = BPlatformServiceAlarmRecord.newProperty((int)0, (BValue)BAbsTime.NULL, null);
public static final Property alarmData = BPlatformServiceAlarmRecord.newProperty((int)0, (BValue)BFacets.DEFAULT, null);
public static final Type TYPE;
static /* synthetic */ Class class$com$tridium$platform$alarm$BPlatformServiceAlarmRecord;
public BUuid getUuid() {
return (BUuid)this.get(uuid);
}
public void setUuid(BUuid bUuid) {
this.set(uuid, (BValue)bUuid, null);
}
public BOrd getSource() {
return (BOrd)this.get(source);
}
public void setSource(BOrd bOrd) {
this.set(source, (BValue)bOrd, null);
}
public String getAlarmClass() {
return this.getString(alarmClass);
}
public void setAlarmClass(String string) {
this.setString(alarmClass, string, null);
}
public BPlatformServiceSourceState getSourceState() {
return (BPlatformServiceSourceState)this.get(sourceState);
}
public void setSourceState(BPlatformServiceSourceState bPlatformServiceSourceState) {
this.set(sourceState, (BValue)bPlatformServiceSourceState, null);
}
public BAbsTime getTimestamp() {
return (BAbsTime)this.get(timestamp);
}
public void setTimestamp(BAbsTime bAbsTime) {
this.set(timestamp, (BValue)bAbsTime, null);
}
public BFacets getAlarmData() {
return (BFacets)this.get(alarmData);
}
public void setAlarmData(BFacets bFacets) {
this.set(alarmData, (BValue)bFacets, 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 BPlatformServiceAlarmRecord() {
this.setUuid(BUuid.make());
}
public BPlatformServiceAlarmRecord(BOrd bOrd, String string, BPlatformServiceSourceState bPlatformServiceSourceState, BFacets bFacets) {
this.setUuid(BUuid.make());
this.setSource(bOrd);
this.setAlarmClass(string);
this.setSourceState(bPlatformServiceSourceState);
this.setTimestamp(BAbsTime.now());
this.setAlarmData(bFacets);
}
static {
Class clazz = class$com$tridium$platform$alarm$BPlatformServiceAlarmRecord;
if (clazz == null) {
clazz = class$com$tridium$platform$alarm$BPlatformServiceAlarmRecord = BPlatformServiceAlarmRecord.class("[Lcom.tridium.platform.alarm.BPlatformServiceAlarmRecord;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,70 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.sys.BFrozenEnum
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform.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 BPlatformServiceSourceState
extends BFrozenEnum {
public static final int OFFNORMAL = 0;
public static final int FAULT = 1;
public static final int NORMAL = 2;
public static final int ALERT = 3;
public static final BPlatformServiceSourceState offnormal = new BPlatformServiceSourceState(0);
public static final BPlatformServiceSourceState fault = new BPlatformServiceSourceState(1);
public static final BPlatformServiceSourceState normal = new BPlatformServiceSourceState(2);
public static final BPlatformServiceSourceState alert = new BPlatformServiceSourceState(3);
public static final Type TYPE;
public static final BPlatformServiceSourceState DEFAULT;
static /* synthetic */ Class class$com$tridium$platform$alarm$BPlatformServiceSourceState;
public final Type getType() {
return TYPE;
}
public static final BPlatformServiceSourceState make(int n) {
return (BPlatformServiceSourceState)offnormal.getRange().get(n, false);
}
public static final BPlatformServiceSourceState make(String string) {
return (BPlatformServiceSourceState)offnormal.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 BPlatformServiceSourceState(int n) {
super(n);
}
static {
Class clazz = class$com$tridium$platform$alarm$BPlatformServiceSourceState;
if (clazz == null) {
clazz = class$com$tridium$platform$alarm$BPlatformServiceSourceState = BPlatformServiceSourceState.class("[Lcom.tridium.platform.alarm.BPlatformServiceSourceState;", false);
}
TYPE = Sys.loadType((Class)clazz);
DEFAULT = offnormal;
}
}
@@ -0,0 +1,11 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platform.alarm;
import com.tridium.platform.alarm.BPlatformServiceAlarmRecord;
public interface PlatformServiceAlarmListener {
public void platformServiceAlarm(BPlatformServiceAlarmRecord var1);
}
@@ -0,0 +1,13 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platform.archive;
import java.io.File;
public interface FileArchive {
public void writeFile(File var1, String var2);
public void close();
}
@@ -0,0 +1,17 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platform.archive;
import com.tridium.platform.archive.FileArchive;
import java.io.File;
public class NullFileArchive
implements FileArchive {
public void writeFile(File file, String string) {
}
public void close() {
}
}
@@ -0,0 +1,140 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.file.FileUtil
* javax.baja.log.Log
*/
package com.tridium.platform.archive;
import com.tridium.platform.archive.FileArchive;
import com.tridium.platform.archive.ZipArchiveReader;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipException;
import java.util.zip.ZipOutputStream;
import javax.baja.file.FileUtil;
import javax.baja.log.Log;
public class ZipArchive
implements FileArchive {
public static Log log = Log.getLog((String)"platform.zipArchive");
String archiveName;
String archivePath;
private File archiveFile;
private File workingFile;
private ZipOutputStream out;
int maxBackups;
public void writeFile(File file, String string) {
try {
int n;
if (!file.exists()) {
log.warning(file + " does not exist!");
return;
}
if (file.isDirectory()) {
throw new IllegalArgumentException("File is directory: " + file);
}
if ((string = string.replace('\\', '/')).charAt(0) == '/') {
string = string.substring(1);
}
ZipEntry zipEntry = new ZipEntry(string);
zipEntry.setSize(file.length());
zipEntry.setTime(file.lastModified());
try {
this.out.putNextEntry(zipEntry);
}
catch (ZipException zipException) {
log.warning("Archive " + this.archiveName + " unable to put zip entry ", (Throwable)zipException);
return;
}
log.trace("Adding " + string);
FileInputStream fileInputStream = new FileInputStream(file);
BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream);
byte[] byArray = new byte[4096];
while ((n = bufferedInputStream.read(byArray)) != -1) {
this.out.write(byArray, 0, n);
}
bufferedInputStream.close();
this.out.closeEntry();
}
catch (Exception exception) {
exception.printStackTrace();
}
}
public void close() {
try {
this.out.flush();
this.out.close();
log.trace("renaming archive file to backup " + this.archiveFile);
FileUtil.renameToBackup((File)this.archiveFile, (int)this.maxBackups);
log.trace("renaming working file to backup " + this.archiveFile);
this.workingFile.renameTo(this.archiveFile);
}
catch (Exception exception) {
exception.printStackTrace();
}
}
public static void unzip(String string, String string2, String string3) throws IOException {
Object object;
File file = new File(string3);
if (!file.exists()) {
file.mkdir();
} else if (!file.isDirectory()) {
throw new IllegalArgumentException("destDir <" + file + "> is not a directory");
}
File[] fileArray = file.listFiles();
int n = 0;
while (n < fileArray.length) {
FileUtil.delete((File)fileArray[n]);
++n;
}
File file2 = new File(string, string2);
if (!file2.exists()) {
object = new File(string, string2 + ".working");
if (((File)object).exists()) {
((File)object).renameTo(file2);
} else {
return;
}
}
object = new ZipArchiveReader(file2, false);
((ZipArchiveReader)object).extractAll(file);
}
public ZipArchive(String string, String string2, int n) {
try {
this.archivePath = string;
this.archiveName = string2;
this.archiveFile = new File(string, string2);
this.workingFile = new File(this.archiveFile + ".working");
this.maxBackups = n;
if (this.archiveFile.isDirectory()) {
throw new IllegalArgumentException("File is directory: " + this.archiveFile);
}
this.out = new ZipOutputStream(new FileOutputStream(this.workingFile));
this.out.setMethod(8);
String string3 = string2.substring(0, string2.indexOf(46));
File[] fileArray = FileUtil.getBackups((File)new File(string), (String)string3);
if (fileArray != null && fileArray.length != 0) {
int n2 = fileArray.length - 1;
while (n2 > n) {
log.trace("Deleting " + fileArray[n2]);
fileArray[n2].delete();
--n2;
}
}
}
catch (Exception exception) {
exception.printStackTrace();
}
}
}
@@ -0,0 +1,77 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platform.archive;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class ZipArchiveReader {
private ZipInputStream in;
private boolean isVerbose;
public void extractAll(File file) throws IOException {
ZipEntry zipEntry;
if (!file.exists()) {
throw new IllegalArgumentException("Path does not exist " + file);
}
if (!file.isDirectory()) {
throw new IllegalArgumentException("Path not a directory: " + file);
}
byte[] byArray = new byte[65000];
while ((zipEntry = this.in.getNextEntry()) != null) {
Object object;
String string = file.getPath() + '/' + zipEntry.getName();
String string2 = string.substring(0, string.lastIndexOf(47));
new File(string2).mkdirs();
if (zipEntry.isDirectory()) {
object = new File(string);
((File)object).mkdir();
if (this.isVerbose) {
System.out.println("ZipArchiveReader: creating dir " + string);
}
} else {
object = new FileOutputStream(new File(string));
if (this.isVerbose) {
System.out.println("ZipArchiveReader: expanding " + string);
}
int n = this.in.read(byArray);
while (n >= 0) {
((FileOutputStream)object).write(byArray, 0, n);
n = this.in.read(byArray);
}
((OutputStream)object).flush();
((FileOutputStream)object).close();
}
this.in.closeEntry();
}
}
private final /* synthetic */ void this() {
this.isVerbose = false;
}
public ZipArchiveReader(File file, boolean bl) throws IOException {
this.this();
if (!file.exists()) {
throw new IllegalArgumentException("File does not exist: " + file);
}
if (file.isDirectory()) {
throw new IllegalArgumentException("File is directory: " + file);
}
this.in = new ZipInputStream(new FileInputStream(file));
this.isVerbose = bl;
if (bl) {
System.out.println("archive file name: " + file);
}
}
}
@@ -0,0 +1,238 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.sys.BSingleton
* javax.baja.sys.BajaRuntimeException
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform.command;
import com.tridium.platform.command.BIPlatformCommand;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PushbackInputStream;
import java.util.Arrays;
import javax.baja.sys.BSingleton;
import javax.baja.sys.BajaRuntimeException;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public abstract class BAbstractPlatformCommand
extends BSingleton
implements BIPlatformCommand {
public static final Type TYPE;
static /* synthetic */ Class class$com$tridium$platform$command$BAbstractPlatformCommand;
public Type getType() {
return TYPE;
}
public String getLicenseVendor() {
return null;
}
public String getLicenseFeature() {
return null;
}
public boolean includeInCommandListing() {
return true;
}
protected boolean promptBoolean(String string) {
String string2 = this.promptString(string);
boolean bl = false;
if (string2.charAt(0) == 'Y' || string2.charAt(0) == 'y') {
bl = true;
}
return bl;
}
protected String promptPasswordString(String string) {
return this.promptPasswordString(string, new Filter());
}
protected String promptPasswordString(String string, Filter filter) {
try {
String string2 = null;
while (!filter.accept(string2)) {
System.out.print(string);
string2 = new String(BAbstractPlatformCommand.getPassword(System.in));
}
return string2;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
protected String promptString(String string) {
return this.promptString(string, new Filter());
}
protected String promptString(String string, Filter filter) {
try {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
String string2 = null;
while (!filter.accept(string2)) {
System.out.print(string);
string2 = bufferedReader.readLine();
}
return string2;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
protected static void println(String string) {
System.out.println(string);
}
public static final char[] getPassword(InputStream inputStream) throws IOException {
char[] cArray;
MaskingThread maskingThread = new MaskingThread();
Thread thread = new Thread(maskingThread);
thread.start();
char[] cArray2 = cArray = new char[128];
int n = cArray2.length;
int n2 = 0;
block4: while (true) {
int n3 = inputStream.read();
switch (n3) {
case -1:
case 10: {
break block4;
}
case 13: {
int n4 = inputStream.read();
if (n4 == 10 || n4 == -1) break block4;
if (!(inputStream instanceof PushbackInputStream)) {
inputStream = new PushbackInputStream(inputStream);
}
((PushbackInputStream)inputStream).unread(n4);
}
default: {
if (--n < 0) {
cArray2 = new char[n2 + 128];
n = cArray2.length - n2 - 1;
System.arraycopy(cArray, 0, cArray2, 0, n2);
Arrays.fill(cArray, ' ');
cArray = cArray2;
}
cArray2[n2++] = (char)n3;
continue block4;
}
}
break;
}
maskingThread.stopMasking();
if (n2 == 0) {
return new char[0];
}
char[] cArray3 = new char[n2];
System.arraycopy(cArray2, 0, cArray3, 0, n2);
Arrays.fill(cArray2, ' ');
return cArray3;
}
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$com$tridium$platform$command$BAbstractPlatformCommand;
if (clazz == null) {
clazz = class$com$tridium$platform$command$BAbstractPlatformCommand = BAbstractPlatformCommand.class("[Lcom.tridium.platform.command.BAbstractPlatformCommand;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
public static class Filter {
public boolean accept(String string) {
boolean bl = false;
if (string != null && string.length() > 0) {
bl = true;
}
return bl;
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
private static class MaskingThread
extends Thread {
private volatile boolean stop;
private char echochar;
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public void run() {
int n = Thread.currentThread().getPriority();
Thread.currentThread().setPriority(10);
try {
this.stop = true;
while (this.stop) {
System.out.print("\b" + this.echochar);
try {
Thread.sleep(1L);
}
catch (InterruptedException interruptedException) {
Thread.currentThread().interrupt();
Object var3_3 = null;
Thread.currentThread().setPriority(n);
return;
}
}
Object var3_5 = null;
Thread.currentThread().setPriority(n);
return;
}
catch (Throwable throwable) {
Object var3_4 = null;
Thread.currentThread().setPriority(n);
throw throwable;
}
}
public void stopMasking() {
this.stop = false;
}
private final /* synthetic */ void this() {
this.echochar = (char)32;
}
public MaskingThread() {
super("AbstractPlatformCommand:MaskingThread");
this.this();
}
}
}
@@ -0,0 +1,162 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.util.CommandLineArguments
* javax.baja.naming.BHost
* javax.baja.naming.BOrd
* javax.baja.security.AuthenticationException
* javax.baja.security.BICredentials
* javax.baja.security.BPassword
* javax.baja.security.BUsernameAndPassword
* javax.baja.sys.BajaRuntimeException
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform.command;
import com.tridium.platform.command.BAbstractPlatformCommand;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.task.DaemonSessionTask;
import com.tridium.platform.daemon.task.DaemonSessionTaskListener;
import com.tridium.util.CommandLineArguments;
import java.net.ConnectException;
import javax.baja.naming.BHost;
import javax.baja.naming.BOrd;
import javax.baja.security.AuthenticationException;
import javax.baja.security.BICredentials;
import javax.baja.security.BPassword;
import javax.baja.security.BUsernameAndPassword;
import javax.baja.sys.BajaRuntimeException;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public abstract class BDaemonSessionCommand
extends BAbstractPlatformCommand
implements DaemonSessionTaskListener {
public static final Type TYPE;
private String lastTaskMessage;
static /* synthetic */ Class class$com$tridium$platform$command$BDaemonSessionCommand;
public Type getType() {
return TYPE;
}
/*
* Loose catch block
*/
protected BDaemonSession getSession(CommandLineArguments commandLineArguments) throws ConnectException {
BHost bHost = this.getHost(commandLineArguments);
if (bHost == null) {
return null;
}
int n = this.getPort(commandLineArguments);
BDaemonSession bDaemonSession = BDaemonSession.make(bHost, n);
BUsernameAndPassword bUsernameAndPassword = this.getCredentials(bDaemonSession, commandLineArguments);
bDaemonSession.setCredentials((BICredentials)bUsernameAndPassword);
while (true) {
try {
bDaemonSession.connect();
return bDaemonSession;
}
catch (ConnectException connectException) {
throw connectException;
}
catch (AuthenticationException authenticationException) {
if (commandLineArguments.hasOption("noinput")) {
throw authenticationException;
}
BDaemonSessionCommand.println("Authentication failed");
bUsernameAndPassword = this.getCredentials(bDaemonSession, null);
bDaemonSession.setCredentials((BICredentials)bUsernameAndPassword);
continue;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
break;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
protected BHost getHost(CommandLineArguments commandLineArguments) {
String string = commandLineArguments.getOption("h");
return string == null ? null : (BHost)BOrd.make((String)string).get();
}
public int getPort(CommandLineArguments commandLineArguments) {
return commandLineArguments.getIntOption("p", 3011);
}
public BUsernameAndPassword getCredentials(BDaemonSession bDaemonSession, CommandLineArguments commandLineArguments) throws ConnectException {
String string;
String string2 = commandLineArguments == null ? null : commandLineArguments.getOption("usr");
String string3 = string = commandLineArguments == null ? null : commandLineArguments.getOption("pwd");
if (!(string2 != null || commandLineArguments != null && commandLineArguments.hasOption("noinput"))) {
string2 = this.promptString("User: ");
}
if (!(string != null || commandLineArguments != null && commandLineArguments.hasOption("noinput"))) {
string = this.promptPasswordString("Password: ");
}
if (string2 == null || string == null) {
return null;
}
BUsernameAndPassword bUsernameAndPassword = (BUsernameAndPassword)bDaemonSession.makeCredentials();
bUsernameAndPassword.setUsername(string2);
bUsernameAndPassword.setPassword(BPassword.make((String)string));
return bUsernameAndPassword;
}
public void taskStarted(DaemonSessionTask daemonSessionTask) {
if (!daemonSessionTask.getMessage().equals(this.lastTaskMessage)) {
System.out.println(daemonSessionTask.getMessage());
this.lastTaskMessage = daemonSessionTask.getMessage();
}
}
public void taskUpdated(DaemonSessionTask daemonSessionTask) {
this.taskStarted(daemonSessionTask);
}
public void taskFinished(DaemonSessionTask daemonSessionTask) {
}
public boolean isCancelEnabled() {
return false;
}
static /* synthetic */ Class class(String string, boolean bl) {
try {
Class<?> clazz = Class.forName(string);
if (!bl) {
clazz = clazz.getComponentType();
}
return clazz;
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
private final /* synthetic */ void this() {
this.lastTaskMessage = null;
}
public BDaemonSessionCommand() {
this.this();
}
static {
Class clazz = class$com$tridium$platform$command$BDaemonSessionCommand;
if (clazz == null) {
clazz = class$com$tridium$platform$command$BDaemonSessionCommand = BDaemonSessionCommand.class("[Lcom.tridium.platform.command.BDaemonSessionCommand;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,48 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.util.CommandLineArguments
* javax.baja.sys.BInterface
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform.command;
import com.tridium.util.CommandLineArguments;
import javax.baja.sys.BInterface;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
public interface BIPlatformCommand
extends BInterface {
public static final Type TYPE;
public static final int EXIT_SUCCESS = 0;
public static final int EXIT_FAILURE = 1;
public static final int EXIT_INVALID_USAGE = 2;
public static final int EXIT_FINISHED_WITH_ERRORS = 3;
public static final int EXIT_NO_ACTION = 4;
public void usage();
public int invoke(CommandLineArguments var1) throws Exception;
public String getCommandName();
public boolean includeInCommandListing();
public String getCommandDescription();
public String getLicenseVendor();
public String getLicenseFeature();
static {
Class clazz = 1.class$com$tridium$platform$command$BIPlatformCommand;
if (clazz == null) {
clazz = 1.class$com$tridium$platform$command$BIPlatformCommand = 1.class("[Lcom.tridium.platform.command.BIPlatformCommand;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,301 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.file.types.bog.BBogFile
* com.tridium.nre.security.Aes256PasswordManager
* com.tridium.nre.security.KeyMaterial
* com.tridium.nre.security.KeyRing
* com.tridium.nre.security.SimpleKeyRing
* com.tridium.util.CommandLineArguments
* com.tridium.util.ComponentTreeCursor
* javax.baja.file.BFileSpace
* javax.baja.file.BFileSystem
* javax.baja.file.BIFileStore
* javax.baja.file.BLocalFileStore
* javax.baja.file.FileUtil
* javax.baja.log.Log
* javax.baja.security.BPassword
* javax.baja.space.BComponentSpace
* javax.baja.sys.BComponent
* javax.baja.sys.BValue
* javax.baja.sys.Property
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform.command;
import com.tridium.file.types.bog.BBogFile;
import com.tridium.nre.security.Aes256PasswordManager;
import com.tridium.nre.security.KeyMaterial;
import com.tridium.nre.security.KeyRing;
import com.tridium.nre.security.SimpleKeyRing;
import com.tridium.platform.command.BAbstractPlatformCommand;
import com.tridium.util.CommandLineArguments;
import com.tridium.util.ComponentTreeCursor;
import java.io.File;
import javax.baja.file.BFileSpace;
import javax.baja.file.BFileSystem;
import javax.baja.file.BIFileStore;
import javax.baja.file.BLocalFileStore;
import javax.baja.file.FileUtil;
import javax.baja.log.Log;
import javax.baja.security.BPassword;
import javax.baja.space.BComponentSpace;
import javax.baja.sys.BComponent;
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 BMakeStationPortableCommand
extends BAbstractPlatformCommand {
public static final BMakeStationPortableCommand INSTANCE = new BMakeStationPortableCommand();
public static final Type TYPE;
private static final Log log;
private KeyRing kr;
private boolean errors;
static /* synthetic */ Class class$com$tridium$platform$command$BMakeStationPortableCommand;
public Type getType() {
return TYPE;
}
public void usage() {
BMakeStationPortableCommand.println("");
BMakeStationPortableCommand.println("usage:");
BMakeStationPortableCommand.println(" plat makeportable <flags> <sourceStationDir> [target] [securityDir]");
BMakeStationPortableCommand.println("parameters:");
BMakeStationPortableCommand.println(" sourceStationDir the station directory to convert");
BMakeStationPortableCommand.println(" target the name of the target station. Defaults to the name of the source station.");
BMakeStationPortableCommand.println(" securityDir the security directory of the source station. Defaults to <sourceStationDir>/../../security");
BMakeStationPortableCommand.println("optional flags:");
BMakeStationPortableCommand.println(" -o overwrite existing destStationDir");
BMakeStationPortableCommand.println(" -locale:<x> set the default locale (en_US)");
BMakeStationPortableCommand.println(" -@<option> pass option to Java VM");
BMakeStationPortableCommand.println(" -buildreg force rebuild of the registry");
BMakeStationPortableCommand.println("");
}
public int invoke(CommandLineArguments commandLineArguments) {
if (commandLineArguments.hasHelpOption()) {
this.usage();
return 2;
}
if (commandLineArguments.parameters.length < 1) {
this.usage();
return 2;
}
String string = commandLineArguments.parameters[0];
File file = new File(string);
String string2 = commandLineArguments.parameters.length > 1 ? commandLineArguments.parameters[1] : file.getName();
File file2 = new File(Sys.getBajaHome(), "stations" + File.separator + string2);
File file3 = commandLineArguments.parameters.length > 2 ? new File(commandLineArguments.parameters[2]) : new File(file.getParentFile().getParentFile(), "security");
File file4 = new File(file3, ".km");
File file5 = new File(file3, ".kr");
if (!file.isDirectory()) {
log.error("Source directory " + file.getAbsolutePath() + " is not a directory or does not exist.");
return 2;
}
if (!file3.isDirectory()) {
log.error("Security directory " + file3.getAbsolutePath() + " is not a directory or does not exist.");
return 2;
}
if (!file4.isFile()) {
log.error("Key material file " + file4.getAbsolutePath() + " does not exist.");
return 2;
}
if (!file5.isFile()) {
log.error("Key ring file " + file5.getAbsolutePath() + " does not exist.");
return 2;
}
try {
LegacyKeyMaterial legacyKeyMaterial = new LegacyKeyMaterial(file4);
this.kr = new SimpleKeyRing(file3, ".kr", (KeyMaterial)legacyKeyMaterial);
}
catch (Exception exception) {
log.error("Could not get key ring: " + exception);
return 1;
}
if (commandLineArguments.hasOption("o")) {
try {
FileUtil.delete((File)file2);
}
catch (Exception exception) {
log.error("Could not overwrite existing destination directory: " + exception);
return 1;
}
} else if (file2.exists()) {
log.error("Destination directory " + file2.getAbsolutePath() + " already exists. Rerun with '-o' to overwrite.");
return 2;
}
log.message("Copying station directory " + file.getAbsolutePath() + " to " + file2.getAbsolutePath());
try {
FileUtil.copyDir((File)file, (File)file2);
}
catch (Exception exception) {
log.warning("Could not copy source station: " + exception);
return 1;
}
this.convertBogs(file2);
if (this.errors) {
log.message("Done with errors.");
return 3;
}
log.message("Done.");
return 0;
}
public void convertBogs(File file) {
File[] fileArray = file.listFiles();
if (fileArray != null) {
int n = 0;
while (n < fileArray.length) {
if (fileArray[n].isDirectory()) {
this.convertBogs(fileArray[n]);
} else if (fileArray[n].getName().endsWith(".bog")) {
this.convertBog(fileArray[n]);
}
++n;
}
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public void convertBog(File file) {
Property[] propertyArray;
log.message("Converting bog " + file.getAbsolutePath());
BBogFile bBogFile = new BBogFile((BIFileStore)new BLocalFileStore((BFileSpace)BFileSystem.INSTANCE, BFileSystem.INSTANCE.localFileToPath(file), file));
BComponentSpace bComponentSpace = (BComponentSpace)bBogFile.open();
BComponent bComponent = bComponentSpace.getRootComponent();
ComponentTreeCursor componentTreeCursor = new ComponentTreeCursor(bComponent, null);
while (componentTreeCursor.nextComponent()) {
BComponent bComponent2 = (BComponent)componentTreeCursor.get();
propertyArray = bComponent2.getPropertiesArray();
int n = 0;
while (n < propertyArray.length) {
BPassword bPassword;
String string;
BValue bValue = bComponent2.get(propertyArray[n]);
if (bValue instanceof BPassword && (!bValue.equals((Object)propertyArray[n].getDefaultValue()) || propertyArray[n].isDynamic()) && (string = (bPassword = (BPassword)bValue).getPasswordEncoder().getEncodingType()).equals("aes256/text")) {
String string2 = bPassword.getPasswordEncoder().getEncodedValue();
int n2 = string2.indexOf(":");
String string3 = string2.substring(0, n2);
String string4 = string2.substring(n2 + 1);
try {
String string5 = Aes256PasswordManager.getManager((KeyRing)this.kr).decrypt(string4, string3);
BPassword bPassword2 = BPassword.make((String)string5);
bComponent2.set(propertyArray[n], (BValue)bPassword2);
log.trace("Converted password " + bComponent2.getSlotPathOrd() + '/' + propertyArray[n].getName());
}
catch (Exception exception) {
log.warning("Could not convert password " + bComponent2.getSlotPathOrd() + '/' + propertyArray[n].getName() + ": " + exception);
this.errors = true;
}
}
++n;
}
}
try {
try {
bBogFile.save();
}
catch (Exception exception) {
log.warning("Could not save bog " + file.getAbsolutePath() + ": " + exception);
this.errors = true;
}
propertyArray = null;
}
catch (Throwable throwable) {
propertyArray = null;
bBogFile.close();
throw throwable;
}
bBogFile.close();
}
public String getCommandName() {
return "makeportable";
}
public String getCommandDescription() {
return "Convert station to use portable encoding for reversible passwords.";
}
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.errors = false;
}
public BMakeStationPortableCommand() {
this.this();
}
static {
Class clazz = class$com$tridium$platform$command$BMakeStationPortableCommand;
if (clazz == null) {
clazz = class$com$tridium$platform$command$BMakeStationPortableCommand = BMakeStationPortableCommand.class("[Lcom.tridium.platform.command.BMakeStationPortableCommand;", false);
}
TYPE = Sys.loadType((Class)clazz);
log = Log.getLog((String)"makeportable");
}
private static class LegacyKeyMaterial
extends KeyMaterial {
File kmFile;
/*
* Exception decompiling
*/
public byte[] getKeyMaterial() throws Exception {
/*
* This method has failed to decompile. When submitting a bug report, please provide this stack trace, and (if you hold appropriate legal rights) the relevant class file.
*
* org.benf.cfr.reader.util.ConfusedCFRException: Back jump on a try block [egrp 1[TRYBLOCK] [1 : 117->120)] java.lang.Throwable
* at org.benf.cfr.reader.bytecode.analysis.opgraph.Op02WithProcessedDataAndRefs.insertExceptionBlocks(Op02WithProcessedDataAndRefs.java:2283)
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisInner(CodeAnalyser.java:415)
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisOrWrapFail(CodeAnalyser.java:278)
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysis(CodeAnalyser.java:201)
* at org.benf.cfr.reader.entities.attributes.AttributeCode.analyse(AttributeCode.java:94)
* at org.benf.cfr.reader.entities.Method.analyse(Method.java:531)
* at org.benf.cfr.reader.entities.ClassFile.analyseMid(ClassFile.java:1055)
* at org.benf.cfr.reader.entities.ClassFile.analyseInnerClassesPass1(ClassFile.java:923)
* at org.benf.cfr.reader.entities.ClassFile.analyseMid(ClassFile.java:1035)
* at org.benf.cfr.reader.entities.ClassFile.analyseTop(ClassFile.java:942)
* at org.benf.cfr.reader.Driver.doJarVersionTypes(Driver.java:257)
* at org.benf.cfr.reader.Driver.doJar(Driver.java:139)
* at org.benf.cfr.reader.CfrDriverImpl.analyse(CfrDriverImpl.java:76)
* at org.benf.cfr.reader.Main.main(Main.java:54)
*/
throw new IllegalStateException("Decompilation failed");
}
public void setKeyMaterial(byte[] byArray) throws Exception {
throw new UnsupportedOperationException();
}
private LegacyKeyMaterial(File file) {
this.kmFile = file;
}
}
}
@@ -0,0 +1,186 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.sys.Nre
* com.tridium.util.CommandLineArguments
* javax.baja.license.FeatureNotLicensedException
* javax.baja.license.LicenseDatabaseException
* javax.baja.nre.util.TextUtil
* javax.baja.registry.TypeInfo
* javax.baja.sys.BObject
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform.command;
import com.tridium.platform.command.BIPlatformCommand;
import com.tridium.sys.Nre;
import com.tridium.util.CommandLineArguments;
import java.util.Comparator;
import java.util.TreeSet;
import javax.baja.license.FeatureNotLicensedException;
import javax.baja.license.LicenseDatabaseException;
import javax.baja.nre.util.TextUtil;
import javax.baja.registry.TypeInfo;
import javax.baja.sys.BObject;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BPlat
extends BObject {
public static final Type TYPE;
private static BIPlatformCommand[] licensedCommands;
static /* synthetic */ Class class$com$tridium$platform$command$BPlat;
public Type getType() {
return TYPE;
}
public static void commands() {
BIPlatformCommand[] bIPlatformCommandArray = BPlat.getLicensedCommands();
int n = 0;
while (n < bIPlatformCommandArray.length) {
if (bIPlatformCommandArray[n].includeInCommandListing()) {
BPlat.println(" " + bIPlatformCommandArray[n].getCommandName());
BPlat.println(" " + bIPlatformCommandArray[n].getCommandDescription());
}
++n;
}
BPlat.println(" installdaemon");
BPlat.println(" install the Niagara Platform service (Win32 only)");
BPlat.println(" uninstalldaemon");
BPlat.println(" remove the Niagara Platform service (Win32 only)");
BPlat.println(" stopdaemon");
BPlat.println(" stop the Niagara Platform service (Win32 only)");
BPlat.println(" restartdaemon");
BPlat.println(" restart the Niagara Platform service (Win32 only)");
}
public static void usage() {
if (Nre.args.parameters.length < 2) {
BPlat.showUsage();
return;
}
BIPlatformCommand[] bIPlatformCommandArray = BPlat.getLicensedCommands();
int n = 0;
while (n < bIPlatformCommandArray.length) {
if (Nre.args.parameters[1].equals(bIPlatformCommandArray[n].getCommandName())) {
bIPlatformCommandArray[n].usage();
return;
}
++n;
}
BPlat.showUsage();
}
private static final void showUsage() {
BPlat.println("");
BPlat.println("usage:");
BPlat.println(" plat <command> <flags> <command-flags>");
BPlat.println("commands:");
BPlat.commands();
BPlat.println("optional flags:");
BPlat.println(" -usage plat -usage prints this message");
BPlat.println(" plat <command> -usage prints command");
BPlat.println(" specific usage");
BPlat.println(" -? same as -usage");
BPlat.println(" -help same as -usage");
BPlat.println(" -locale:<x> set the default locale (en_US)");
BPlat.println(" -@<option> pass option to Java VM");
BPlat.println(" -buildreg force rebuild of the registry");
BPlat.println("");
}
private static final BIPlatformCommand[] getLicensedCommands() {
if (licensedCommands == null) {
TreeSet<BIPlatformCommand> treeSet = new TreeSet<BIPlatformCommand>(new Comparator(){
public final int compare(Object object, Object object2) {
return ((BIPlatformCommand)object).getCommandName().compareTo(((BIPlatformCommand)object2).getCommandName());
}
});
TypeInfo[] typeInfoArray = Sys.getRegistry().getConcreteTypes(BIPlatformCommand.TYPE.getTypeInfo());
int n = 0;
while (n < typeInfoArray.length) {
BIPlatformCommand bIPlatformCommand = (BIPlatformCommand)typeInfoArray[n].getInstance();
try {
if (bIPlatformCommand.getLicenseVendor() != null && bIPlatformCommand.getLicenseFeature() != null) {
Sys.getLicenseManager().checkFeature(bIPlatformCommand.getLicenseVendor(), bIPlatformCommand.getLicenseFeature());
}
treeSet.add(bIPlatformCommand);
}
catch (FeatureNotLicensedException featureNotLicensedException) {
}
catch (LicenseDatabaseException licenseDatabaseException) {}
++n;
}
licensedCommands = new BIPlatformCommand[treeSet.size()];
treeSet.toArray(licensedCommands);
}
return licensedCommands;
}
public static int parse(String string) {
return BPlat.parse(TextUtil.splitAndTrim((String)string, (char)' '));
}
public static int parse(String[] stringArray) {
try {
if (stringArray.length == 0) {
BPlat.showUsage();
return 2;
}
BIPlatformCommand[] bIPlatformCommandArray = BPlat.getLicensedCommands();
int n = 0;
while (n < bIPlatformCommandArray.length) {
if (stringArray[0].equals(bIPlatformCommandArray[n].getCommandName())) {
String[] stringArray2 = new String[stringArray.length - 1];
System.arraycopy(stringArray, 1, stringArray2, 0, stringArray.length - 1);
return bIPlatformCommandArray[n].invoke(new CommandLineArguments(stringArray2));
}
++n;
}
BPlat.showUsage();
return 2;
}
catch (Throwable throwable) {
throwable.printStackTrace();
return 1;
}
}
public static void main(String[] stringArray) {
System.exit(BPlat.parse(stringArray));
}
static void println(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());
}
}
static {
Class clazz = class$com$tridium$platform$command$BPlat;
if (clazz == null) {
clazz = class$com$tridium$platform$command$BPlat = BPlat.class("[Lcom.tridium.platform.command.BPlat;", false);
}
TYPE = Sys.loadType((Class)clazz);
licensedCommands = null;
}
}
@@ -0,0 +1,208 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.util.CommandLineArguments
* javax.baja.file.BFileSystem
* javax.baja.file.FilePath
* javax.baja.nre.util.TextUtil
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform.command;
import com.tridium.platform.command.BAbstractPlatformCommand;
import com.tridium.platform.command.BPlat;
import com.tridium.util.CommandLineArguments;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Iterator;
import javax.baja.file.BFileSystem;
import javax.baja.file.FilePath;
import javax.baja.nre.util.TextUtil;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BPlatformCommandScript
extends BAbstractPlatformCommand {
public static final BPlatformCommandScript INSTANCE = new BPlatformCommandScript();
public static final Type TYPE;
static /* synthetic */ Class class$com$tridium$platform$command$BPlatformCommandScript;
public Type getType() {
return TYPE;
}
public String getCommandName() {
return "script";
}
public String getCommandDescription() {
return "run one or more platform commands in a script";
}
public void usage() {
BPlatformCommandScript.println("usage:");
BPlatformCommandScript.println(" plat script <flags>");
BPlatformCommandScript.println("optional flags:");
BPlatformCommandScript.println(" -f:<filePath> reads the script from the given file, instead");
BPlatformCommandScript.println(" of from standard input");
BPlatformCommandScript.println(" -echo echo commands read from the script");
BPlatformCommandScript.println(" -usage prints this message");
BPlatformCommandScript.println(" -? same as -usage");
BPlatformCommandScript.println(" -help same as -usage");
BPlatformCommandScript.println(" -locale:<x> set the default locale (en_US)");
BPlatformCommandScript.println(" -@<option> pass option to Java VM");
BPlatformCommandScript.println(" -buildreg force rebuild of the registry");
BPlatformCommandScript.println("");
}
public void help() {
BPlatformCommandScript.println("Script commands:");
BPlatformCommandScript.println(" quit");
BPlatformCommandScript.println(" Quit this program");
BPlatformCommandScript.println(" help");
BPlatformCommandScript.println(" Display this help message");
BPlatformCommandScript.println(" option -<optName>:<optVal>*");
BPlatformCommandScript.println(" Set the default value for the given command option(s)");
BPlatformCommandScript.println(" removeopt -<optName>");
BPlatformCommandScript.println(" Remove a default option value previously set with 'option'");
BPlatformCommandScript.println(" showoptions");
BPlatformCommandScript.println(" Show all default option values");
BPlatformCommandScript.println(" <command> <commandopts>");
BPlatformCommandScript.println(" Execute one of the platform commands listed below");
BPlatformCommandScript.println("Platform commands:");
BPlat.commands();
}
public int invoke(CommandLineArguments commandLineArguments) throws Exception {
String string;
BufferedReader bufferedReader;
Object object;
boolean bl = false;
boolean bl2 = commandLineArguments.hasOption("echo");
if (commandLineArguments.hasHelpOption()) {
this.usage();
return 0;
}
if (commandLineArguments.hasOption("f")) {
object = BFileSystem.INSTANCE.findFile(new FilePath(commandLineArguments.getOption("f")));
if (object == null) {
System.out.println("File not found");
return 1;
}
bufferedReader = new BufferedReader(new InputStreamReader(object.getInputStream()));
} else {
bufferedReader = new BufferedReader(new InputStreamReader(System.in));
bl = true;
}
object = new HashMap();
int n = 0;
while (n < commandLineArguments.options.length) {
if (!commandLineArguments.options[n].equals("f")) {
((HashMap)object).put(commandLineArguments.options[n], commandLineArguments.optionValues[n]);
}
++n;
}
if (bl) {
System.out.println("Type 'quit' to exit, 'help' for instructions");
System.out.print("> ");
}
while ((string = bufferedReader.readLine()) != null) {
String string2;
if (bl2) {
System.out.println(string);
}
string = string.trim();
CommandLineArguments commandLineArguments2 = new CommandLineArguments(TextUtil.splitAndTrim((String)string, (char)' '));
while (commandLineArguments2.parameters.length == 0 || commandLineArguments2.parameters[0].equals("plat")) {
if (commandLineArguments2.parameters.length <= 0) continue;
string = string.substring(5).trim();
commandLineArguments2 = new CommandLineArguments(TextUtil.splitAndTrim((String)string, (char)' '));
}
if (commandLineArguments2.parameters.length == 0 || commandLineArguments2.parameters[0].trim().length() == 0) {
if (commandLineArguments2.options.length > 0) {
this.help();
}
if (!bl) continue;
System.out.print("> ");
continue;
}
if (commandLineArguments2.parameters[0].equals("quit")) break;
if (commandLineArguments2.parameters[0].equals("help")) {
this.help();
if (!bl) continue;
System.out.print("> ");
continue;
}
if (commandLineArguments2.parameters[0].equals("option")) {
int n2 = 0;
while (n2 < commandLineArguments2.options.length) {
((HashMap)object).put(commandLineArguments2.options[n2], commandLineArguments2.optionValues[n2]);
++n2;
}
if (!bl) continue;
System.out.print("> ");
continue;
}
if (commandLineArguments2.parameters[0].equals("removeopt")) {
int n3 = 0;
while (n3 < commandLineArguments2.options.length) {
((HashMap)object).remove(commandLineArguments2.options[n3]);
++n3;
}
if (!bl) continue;
System.out.print("> ");
continue;
}
if (commandLineArguments2.parameters[0].equals("showoptions")) {
System.out.println("Default options:");
Iterator iterator = ((HashMap)object).keySet().iterator();
while (iterator.hasNext()) {
string2 = (String)iterator.next();
System.out.println(" " + string2 + ':' + ((HashMap)object).get(string2));
}
if (!bl) continue;
System.out.print("> ");
continue;
}
Iterator iterator = ((HashMap)object).keySet().iterator();
while (iterator.hasNext()) {
string2 = (String)iterator.next();
if (commandLineArguments2.hasOption(string2)) continue;
string = string + " -" + string2 + ':' + ((HashMap)object).get(string2);
}
BPlat.parse(string);
if (!bl) continue;
System.out.print("> ");
}
bufferedReader.close();
return 0;
}
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$com$tridium$platform$command$BPlatformCommandScript;
if (clazz == null) {
clazz = class$com$tridium$platform$command$BPlatformCommandScript = BPlatformCommandScript.class("[Lcom.tridium.platform.command.BPlatformCommandScript;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,166 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.naming.BHost
* javax.baja.net.HttpConnection
* javax.baja.nre.util.TextUtil
* javax.baja.security.AuthenticationRealm
* javax.baja.security.BICredentials
* javax.baja.security.BUsernameAndPassword
*/
package com.tridium.platform.daemon;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.BasicAuthenticator;
import com.tridium.platform.daemon.DigestAuthenticator;
import java.io.IOException;
import java.security.MessageDigest;
import java.util.Properties;
import java.util.StringTokenizer;
import javax.baja.naming.BHost;
import javax.baja.net.HttpConnection;
import javax.baja.nre.util.TextUtil;
import javax.baja.security.AuthenticationRealm;
import javax.baja.security.BICredentials;
import javax.baja.security.BUsernameAndPassword;
public abstract class Authenticator
implements AuthenticationRealm {
private BUsernameAndPassword credentials;
public static Authenticator make(BHost bHost, int n, String string, HttpConnection httpConnection) {
return Authenticator.make(null, bHost, n, string, httpConnection);
}
public static Authenticator make(Authenticator authenticator, BHost bHost, int n, String string, HttpConnection httpConnection) {
Properties properties = Authenticator.parseHeader(httpConnection, "WWW-Authenticate");
if (properties == null) {
return null;
}
Authenticator authenticator2 = authenticator;
String string2 = properties.getProperty("0");
String string3 = Authenticator.unquote(properties.getProperty("realm", string));
if (string3.equals("Niagara-Admin")) {
string3 = string;
}
if (string2.equalsIgnoreCase("digest")) {
if (authenticator2 == null || !(authenticator2 instanceof DigestAuthenticator)) {
authenticator2 = new DigestAuthenticator(bHost, n, string3);
} else {
DigestAuthenticator digestAuthenticator = (DigestAuthenticator)authenticator2;
if (!digestAuthenticator.getHost().getAbsoluteOrd().equals((Object)bHost.getAbsoluteOrd()) || digestAuthenticator.getPort() != n) {
authenticator2 = new DigestAuthenticator(bHost, n, string3);
}
}
} else if (string2.equalsIgnoreCase("basic")) {
if (authenticator2 == null || !(authenticator2 instanceof BasicAuthenticator)) {
authenticator2 = new BasicAuthenticator(string3);
}
} else {
throw new IllegalArgumentException("Unsupported auth type: " + string2);
}
return authenticator2;
}
public abstract boolean setAuthorization(HttpConnection var1, String var2) throws IOException;
public abstract boolean setAuthorization(HttpConnection var1, String var2, Properties var3) throws IOException;
public boolean hasCredentials() {
boolean bl = false;
if (this.credentials != null && this.credentials.getPassword() != null && this.credentials.getUsername() != null && !this.credentials.getUsername().equals("")) {
bl = true;
}
return bl;
}
protected BUsernameAndPassword getUserAndPwd() {
return (BUsernameAndPassword)this.getCredentials();
}
public void setCredentials(BICredentials bICredentials) {
this.credentials = (BUsernameAndPassword)bICredentials;
}
public BICredentials getCredentials() {
if (this.hasCredentials()) {
return this.credentials;
}
return null;
}
public BICredentials makeCredentials() {
return new BUsernameAndPassword();
}
protected String hexMD5(String string) {
StringBuffer stringBuffer = new StringBuffer();
try {
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
byte[] byArray = messageDigest.digest(string.getBytes());
int n = 0;
while (n < byArray.length) {
stringBuffer.append(TextUtil.toLowerCase((String)TextUtil.byteToHexString((int)byArray[n])));
++n;
}
}
catch (Exception exception) {
BDaemonSession.log.error("error creating digest", (Throwable)exception);
}
return stringBuffer.toString();
}
protected static String quote(String string) {
if (string.length() == 0) {
return "\"\"";
}
if (string.charAt(0) == '\"') {
return string;
}
return "\"" + string + '\"';
}
protected static String unquote(String string) {
if (string.length() == 0) {
return string;
}
StringBuffer stringBuffer = new StringBuffer(string);
if (stringBuffer.charAt(0) == '\"') {
stringBuffer.deleteCharAt(0);
}
if (stringBuffer.charAt(stringBuffer.length() - 1) == '\"') {
stringBuffer.deleteCharAt(stringBuffer.length() - 1);
}
return stringBuffer.toString();
}
protected static Properties parseHeader(HttpConnection httpConnection, String string) {
String string2 = httpConnection.getResponseHeader(string);
if (string2 == null) {
return null;
}
Properties properties = Authenticator.parseHeader(string2);
return properties;
}
protected static Properties parseHeader(String string) {
Properties properties = new Properties();
int n = 0;
StringTokenizer stringTokenizer = new StringTokenizer(string, " ");
while (stringTokenizer.hasMoreTokens()) {
int n2;
String string2 = stringTokenizer.nextToken();
if (string2.endsWith(",")) {
string2 = string2.substring(0, string2.length() - 1);
}
if ((n2 = string2.indexOf(61)) < 0) {
properties.setProperty(String.valueOf(n++), string2);
continue;
}
properties.setProperty(string2.substring(0, n2), string2.substring(n2 + 1));
}
return properties;
}
}
@@ -0,0 +1,962 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.net.HttpUtil
* javax.baja.log.Log
* javax.baja.nre.util.Array
* javax.baja.security.AuthenticationException
* javax.baja.sys.BComponent
* javax.baja.sys.BIcon
* javax.baja.sys.BValue
* javax.baja.sys.BajaRuntimeException
* javax.baja.sys.Context
* javax.baja.sys.LocalizableRuntimeException
* javax.baja.sys.Property
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.util.Lexicon
* javax.baja.xml.XElem
* javax.baja.xml.XParser
*/
package com.tridium.platform.daemon;
import com.tridium.net.HttpUtil;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.BR2StationSurrogate;
import com.tridium.platform.daemon.BSedonaSurrogate;
import com.tridium.platform.daemon.BStationSurrogate;
import com.tridium.platform.daemon.ConsoleInputStream;
import com.tridium.platform.daemon.message.DaemonMessage;
import com.tridium.platform.daemon.message.DeleteAppMessage;
import com.tridium.platform.daemon.message.GetAppListMessage;
import com.tridium.platform.daemon.message.UpdateAppMessage;
import com.tridium.platform.daemon.message.XmlResponseMessage;
import com.tridium.platform.daemon.task.CancelableDaemonSessionTask;
import com.tridium.platform.daemon.task.DaemonSessionTaskListener;
import java.io.ByteArrayOutputStream;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
import java.io.PrintStream;
import java.net.ConnectException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;
import javax.baja.log.Log;
import javax.baja.nre.util.Array;
import javax.baja.platform.BStationStatus;
import javax.baja.platform.ICancelHint;
import javax.baja.security.AuthenticationException;
import javax.baja.sys.BComponent;
import javax.baja.sys.BIcon;
import javax.baja.sys.BValue;
import javax.baja.sys.BajaRuntimeException;
import javax.baja.sys.Context;
import javax.baja.sys.LocalizableRuntimeException;
import javax.baja.sys.Property;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.util.Lexicon;
import javax.baja.xml.XElem;
import javax.baja.xml.XParser;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public abstract class BAppSurrogate
extends BComponent {
public static final int PORT_UNKNOWN = -1;
public static final Property isAutoStart = BAppSurrogate.newProperty((int)3, (boolean)false, null);
public static final Property isAutoRestart = BAppSurrogate.newProperty((int)3, (boolean)false, null);
public static final Property appStatus = BAppSurrogate.newProperty((int)3, (BValue)BStationStatus.unknown, null);
public static final Property appName = BAppSurrogate.newProperty((int)3, (String)"", null);
public static final Property isDisabled = BAppSurrogate.newProperty((int)3, (boolean)false, null);
public static final Property isDirty = BAppSurrogate.newProperty((int)3, (boolean)false, null);
public static final Property isAcceptingMessages = BAppSurrogate.newProperty((int)3, (boolean)false, null);
public static final Property logBufferSize = BAppSurrogate.newProperty((int)3, (int)Short.MAX_VALUE, null);
public static final Property logBufferFileSize = BAppSurrogate.newProperty((int)3, (int)Short.MAX_VALUE, null);
public static final Type TYPE;
protected static final BIcon connectedIcon;
protected static final BIcon disconnectedIcon;
public static final int STREAM_TIMEOUT_MILLIS = 500;
protected static final Lexicon lex;
protected static final Log log;
protected BDaemonSession session;
static /* synthetic */ Class class$com$tridium$platform$daemon$BAppSurrogate;
public boolean getIsAutoStart() {
return this.getBoolean(isAutoStart);
}
public void setIsAutoStart(boolean bl) {
this.setBoolean(isAutoStart, bl, null);
}
public boolean getIsAutoRestart() {
return this.getBoolean(isAutoRestart);
}
public void setIsAutoRestart(boolean bl) {
this.setBoolean(isAutoRestart, bl, null);
}
public BStationStatus getAppStatus() {
return (BStationStatus)this.get(appStatus);
}
public void setAppStatus(BStationStatus bStationStatus) {
this.set(appStatus, (BValue)bStationStatus, null);
}
public String getAppName() {
return this.getString(appName);
}
public void setAppName(String string) {
this.setString(appName, string, null);
}
public boolean getIsDisabled() {
return this.getBoolean(isDisabled);
}
public void setIsDisabled(boolean bl) {
this.setBoolean(isDisabled, bl, null);
}
public boolean getIsDirty() {
return this.getBoolean(isDirty);
}
public void setIsDirty(boolean bl) {
this.setBoolean(isDirty, bl, null);
}
public boolean getIsAcceptingMessages() {
return this.getBoolean(isAcceptingMessages);
}
public void setIsAcceptingMessages(boolean bl) {
this.setBoolean(isAcceptingMessages, bl, null);
}
public int getLogBufferSize() {
return this.getInt(logBufferSize);
}
public void setLogBufferSize(int n) {
this.setInt(logBufferSize, n, null);
}
public int getLogBufferFileSize() {
return this.getInt(logBufferFileSize);
}
public void setLogBufferFileSize(int n) {
this.setInt(logBufferFileSize, n, null);
}
public Type getType() {
return TYPE;
}
public BDaemonSession getDaemonSession() {
return this.session;
}
protected static Map getAppElementMap(BDaemonSession bDaemonSession) throws Exception {
if (bDaemonSession.getHostProperties().supportsServlet("applist")) {
XElem xElem = XParser.make((InputStream)bDaemonSession.getInputStream(new GetAppListMessage())).parse();
HashMap hashMap = new HashMap();
XElem[] xElemArray = xElem.elems("app");
int n = 0;
while (n < xElemArray.length) {
String string = xElemArray[n].get("type");
Type type = BAppSurrogate.getAppType(string);
TreeMap<String, XElem> treeMap = new TreeMap<String, XElem>();
hashMap.put(type, treeMap);
XElem[] xElemArray2 = xElemArray[n].elems(string);
int n2 = 0;
while (n2 < xElemArray2.length) {
treeMap.put(xElemArray2[n2].get("name"), xElemArray2[n2]);
++n2;
}
++n;
}
return hashMap;
}
XElem xElem = XParser.make((InputStream)bDaemonSession.getInputStream(new GetAppListMessage("station"))).parse();
HashMap hashMap = new HashMap();
TreeMap<String, XElem> treeMap = new TreeMap<String, XElem>();
hashMap.put(BStationSurrogate.TYPE, treeMap);
XElem[] xElemArray = xElem.elems("station");
int n = 0;
while (n < xElemArray.length) {
treeMap.put(xElemArray[n].get("name"), xElemArray[n]);
++n;
}
return hashMap;
}
protected static Map getAppElementMap(Type type, BDaemonSession bDaemonSession) throws Exception {
TreeMap treeMap = (TreeMap)BAppSurrogate.getAppElementMap(bDaemonSession).get(type);
if (treeMap == null) {
treeMap = new TreeMap();
}
return treeMap;
}
public void poll() throws Exception {
XElem xElem = (XElem)BAppSurrogate.getAppElementMap(this.getType(), this.getDaemonSession()).get(this.getAppName());
if (xElem != null) {
this.updateFields(xElem);
}
}
public boolean isRestartEnabled() {
return this.getDaemonSession().getHostProperties().getAllowStationRestart();
}
public void updateFields(XElem xElem) {
this.setAppName(xElem.get("name"));
XElem xElem2 = xElem.elem("isdisabled");
if (xElem2 != null) {
this.setIsDisabled(xElem2.getb("value"));
}
if ((xElem2 = xElem.elem("isautostart")) != null) {
this.setIsAutoStart(xElem2.getb("value"));
}
if ((xElem2 = xElem.elem("isautorestart")) != null) {
this.setIsAutoRestart(xElem2.getb("value"));
}
if ((xElem2 = xElem.elem("isdirty")) != null) {
this.setIsDirty(xElem2.getb("value"));
}
if ((xElem2 = xElem.elem("isacceptingmessages")) != null) {
this.setIsAcceptingMessages(xElem2.getb("value"));
}
if ((xElem2 = xElem.elem("status")) != null) {
this.setAppStatus(BStationStatus.make(xElem2.geti("value")));
}
if ((xElem2 = xElem.elem("logbuffersize")) != null) {
this.setLogBufferSize(xElem2.geti("value"));
}
if ((xElem2 = xElem.elem("logbufferfilesize")) != null) {
this.setLogBufferFileSize(xElem2.geti("value"));
}
}
public InputStream getAppOutput() throws ConnectException, AuthenticationException {
return this.getAppOutput(true, false);
}
public InputStream getAppOutput(boolean bl) throws ConnectException, AuthenticationException {
return this.getAppOutput(bl, false);
}
public InputStream getAppOutput(boolean bl, boolean bl2) throws ConnectException, AuthenticationException {
return ConsoleInputStream.make(this.getDaemonSession().getInputStream((DaemonMessage)new GetAppOutputMessage(this.getAppTypeString(), this.getAppName(), bl, bl2), 500));
}
public void updateLogBufferSize(int n, int n2) throws ConnectException, AuthenticationException {
if (this.getDaemonSession().sendMessage(new UpdateLogBufferSizeMessage(this.getAppTypeString(), this.getAppName(), n, n2, true))) {
this.setLogBufferSize(n);
this.setLogBufferFileSize(n2);
}
}
public void updateSettings(boolean bl, boolean bl2) throws ConnectException, AuthenticationException {
this.getDaemonSession().sendMessage(new UpdateAppMessage(this.getAppTypeString(), this.getAppName(), this.getIsDisabled(), bl, bl2, true));
}
public void checkStart() {
if (!(this.isAppRunning() || this.isRestartEnabled() || this.getAppStatus() != BStationStatus.halted && this.getAppStatus() != BStationStatus.failed)) {
throw new LocalizableRuntimeException("platform", "AppSurrogate.error.startHaltedApp");
}
}
public void startAppAsync() throws ConnectException, AuthenticationException {
this.checkStart();
if (!this.isAppRunning()) {
this.setAppStatus(BStationStatus.starting);
this.getDaemonSession().sendMessage(new StartAppMessage(this.getAppTypeString(), this.getAppName()));
}
}
public void startApp(ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) throws Exception {
this.checkStart();
CancelableDaemonSessionTask cancelableDaemonSessionTask = null;
OutputWatcher outputWatcher = null;
if (daemonSessionTaskListener != null) {
cancelableDaemonSessionTask = this.isAppRunning() ? new CancelableDaemonSessionTask(lex, "AppSurrogate.waiting.title", "AppSurrogate.waiting.message", new Object[]{this.getAppName()}, iCancelHint) : new CancelableDaemonSessionTask(lex, "AppSurrogate.starting.title", "AppSurrogate.starting.message", new Object[]{this.getAppName()}, iCancelHint);
iCancelHint = cancelableDaemonSessionTask;
}
try {
outputWatcher = new OutputWatcher(this.getAppOutput(true, true), cancelableDaemonSessionTask, daemonSessionTaskListener);
outputWatcher.start();
if (daemonSessionTaskListener != null) {
daemonSessionTaskListener.taskStarted(cancelableDaemonSessionTask);
}
this.startAppAsync();
while (true) {
if (BAppSurrogate.isCanceled(cancelableDaemonSessionTask)) {
throw new ICancelHint.CanceledException();
}
this.poll();
if (this.getAppStatus() == BStationStatus.running) {
Object var6_5 = null;
if (daemonSessionTaskListener != null) {
if (outputWatcher != null) {
outputWatcher.stopWatcher();
}
daemonSessionTaskListener.taskFinished(cancelableDaemonSessionTask);
}
return;
}
if (this.getAppStatus() == BStationStatus.failed) {
throw new Exception("Application failed to start");
}
Thread.sleep(1000L);
}
}
catch (Throwable throwable) {
block11: {
Object var6_6 = null;
if (daemonSessionTaskListener == null) break block11;
if (outputWatcher != null) {
outputWatcher.stopWatcher();
}
daemonSessionTaskListener.taskFinished(cancelableDaemonSessionTask);
}
throw throwable;
}
}
public void stopAppAsync() throws ConnectException, AuthenticationException {
try {
this.setAppStatus(BStationStatus.stopping);
this.getDaemonSession().sendMessage(new StopAppMessage(this.getAppTypeString(), this.getAppName()));
}
catch (ConnectException connectException) {
throw connectException;
}
catch (AuthenticationException authenticationException) {
throw authenticationException;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public static BAppSurrogate[] stopAllApps(BDaemonSession bDaemonSession, Type type, ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) throws Exception {
try {
return BAppSurrogate.stopAllApps(bDaemonSession, type, BAppSurrogate.makeAll(type, bDaemonSession), iCancelHint, daemonSessionTaskListener);
}
catch (ConnectException connectException) {
throw connectException;
}
catch (AuthenticationException authenticationException) {
throw authenticationException;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public String getAppTypeString() {
return BAppSurrogate.getAppTypeString(this.getType());
}
public static String getAppTypeString(Type type) {
if (type == BSedonaSurrogate.TYPE) {
return "sedona";
}
if (type == BStationSurrogate.TYPE) {
return "station";
}
if (type == BR2StationSurrogate.TYPE) {
return "r2station";
}
throw new IllegalArgumentException();
}
public static Type getAppType(String string) {
if (string.equals("station")) {
return BStationSurrogate.TYPE;
}
if (string.equals("sedona")) {
return BSedonaSurrogate.TYPE;
}
if (string.equals("r2station")) {
return BR2StationSurrogate.TYPE;
}
throw new IllegalArgumentException("invalid element for BAppSurrogate.make");
}
public static BAppSurrogate make(XElem xElem, BDaemonSession bDaemonSession) throws Exception {
BAppSurrogate bAppSurrogate = null;
if (xElem.name().equals("station")) {
bAppSurrogate = new BStationSurrogate(bDaemonSession);
} else if (xElem.name().equals("sedona")) {
bAppSurrogate = new BSedonaSurrogate(bDaemonSession);
} else if (xElem.name().equals("r2station")) {
bAppSurrogate = new BR2StationSurrogate(bDaemonSession);
} else {
throw new IllegalArgumentException("invalid element for BAppSurrogate.make");
}
((BAppSurrogate)bAppSurrogate).updateFields(xElem);
return bAppSurrogate;
}
public static BAppSurrogate[] makeAll(Type type, BDaemonSession bDaemonSession) throws Exception {
if (type == null) {
Class clazz = class$com$tridium$platform$daemon$BAppSurrogate;
if (clazz == null) {
clazz = class$com$tridium$platform$daemon$BAppSurrogate = BAppSurrogate.class("[Lcom.tridium.platform.daemon.BAppSurrogate;", false);
}
Array array = new Array(clazz);
Map map = BAppSurrogate.getAppElementMap(bDaemonSession);
Iterator iterator = map.values().iterator();
while (iterator.hasNext()) {
Iterator iterator2 = ((Map)iterator.next()).values().iterator();
while (iterator2.hasNext()) {
array.add((Object)BAppSurrogate.make((XElem)iterator2.next(), bDaemonSession));
}
}
return (BAppSurrogate[])array.trim();
}
Map map = BAppSurrogate.getAppElementMap(type, bDaemonSession);
if (map == null) {
System.out.println("apps for " + type + " is null!");
}
BAppSurrogate[] bAppSurrogateArray = (BAppSurrogate[])java.lang.reflect.Array.newInstance(type.getTypeClass(), map.size());
int n = 0;
Iterator iterator = map.values().iterator();
while (iterator.hasNext()) {
bAppSurrogateArray[n] = BAppSurrogate.make((XElem)iterator.next(), bDaemonSession);
++n;
}
return bAppSurrogateArray;
}
public static boolean isAnyAppRunning(Type type, BDaemonSession bDaemonSession) throws Exception {
BAppSurrogate[] bAppSurrogateArray = BAppSurrogate.makeAll(type, bDaemonSession);
int n = 0;
while (n < bAppSurrogateArray.length) {
if (bAppSurrogateArray[n].isAppRunning()) {
return true;
}
++n;
}
return false;
}
protected static XElem getAppElem(BDaemonSession bDaemonSession, BAppSurrogate bAppSurrogate) throws Exception {
Map map = BAppSurrogate.getAppElementMap(bAppSurrogate.getType(), bDaemonSession);
return (XElem)map.get(bAppSurrogate.getAppName());
}
/*
* Exception decompiling
*/
public static BAppSurrogate[] stopAllApps(BDaemonSession var0, Type var1_1, BAppSurrogate[] var2_2, ICancelHint var3_3, DaemonSessionTaskListener var4_4) throws Exception {
/*
* This method has failed to decompile. When submitting a bug report, please provide this stack trace, and (if you hold appropriate legal rights) the relevant class file.
*
* org.benf.cfr.reader.util.ConfusedCFRException: Back jump on a try block [egrp 3[TRYBLOCK] [10 : 410->413)] java.lang.Throwable
* at org.benf.cfr.reader.bytecode.analysis.opgraph.Op02WithProcessedDataAndRefs.insertExceptionBlocks(Op02WithProcessedDataAndRefs.java:2283)
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisInner(CodeAnalyser.java:415)
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisOrWrapFail(CodeAnalyser.java:278)
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysis(CodeAnalyser.java:201)
* at org.benf.cfr.reader.entities.attributes.AttributeCode.analyse(AttributeCode.java:94)
* at org.benf.cfr.reader.entities.Method.analyse(Method.java:531)
* at org.benf.cfr.reader.entities.ClassFile.analyseMid(ClassFile.java:1055)
* at org.benf.cfr.reader.entities.ClassFile.analyseTop(ClassFile.java:942)
* at org.benf.cfr.reader.Driver.doJarVersionTypes(Driver.java:257)
* at org.benf.cfr.reader.Driver.doJar(Driver.java:139)
* at org.benf.cfr.reader.CfrDriverImpl.analyse(CfrDriverImpl.java:76)
* at org.benf.cfr.reader.Main.main(Main.java:54)
*/
throw new IllegalStateException("Decompilation failed");
}
public void stopApp(ICancelHint iCancelHint) throws ConnectException, AuthenticationException {
this.stopApp(iCancelHint, null);
}
/*
* 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 stopApp(ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) throws ConnectException, AuthenticationException {
block14: {
CancelableDaemonSessionTask cancelableDaemonSessionTask;
block13: {
if (this.isAppStopped()) break block14;
cancelableDaemonSessionTask = null;
try {
try {
if (this.getAppStatus() != BStationStatus.stopping) {
if (daemonSessionTaskListener != null) {
cancelableDaemonSessionTask = new CancelableDaemonSessionTask(lex, "AppSurrogate.stopping.title", "AppSurrogate.stopping.message", new Object[]{this.getAppName()}, iCancelHint);
cancelableDaemonSessionTask.setCancelLabel(lex.getText("AppSurrogate.stopping.cancel"));
daemonSessionTaskListener.taskStarted(cancelableDaemonSessionTask);
}
this.stopAppAsync();
this.poll();
while (!this.isAppStopped() && !BAppSurrogate.isCanceled(cancelableDaemonSessionTask)) {
Thread.sleep(1000L);
this.poll();
}
}
}
catch (ConnectException connectException) {
throw connectException;
}
catch (AuthenticationException authenticationException) {
throw authenticationException;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
catch (Throwable throwable) {
Object var5_9 = null;
if (daemonSessionTaskListener != null && cancelableDaemonSessionTask != null) {
daemonSessionTaskListener.taskFinished(cancelableDaemonSessionTask);
}
throw throwable;
}
{
Object var5_10 = null;
if (daemonSessionTaskListener == null || cancelableDaemonSessionTask == null) break block13;
daemonSessionTaskListener.taskFinished(cancelableDaemonSessionTask);
}
}
if (BAppSurrogate.isCanceled(cancelableDaemonSessionTask)) {
throw new ICancelHint.CanceledException();
}
}
}
public void restartAppAsync() throws ConnectException, AuthenticationException {
if (!this.isRestartEnabled()) {
throw new LocalizableRuntimeException("platform", "AppSurrogate.error.restartNotPermitted");
}
this.restartAppAsync(false);
}
public void restartAppAsync(boolean bl) throws ConnectException, AuthenticationException {
if (!this.isRestartEnabled()) {
throw new LocalizableRuntimeException("platform", "AppSurrogate.error.restartNotPermitted");
}
this.setAppStatus(BStationStatus.stopping);
this.getDaemonSession().sendMessage(new RestartAppMessage(this.getAppTypeString(), this.getAppName(), bl));
}
public void deleteApp(ICancelHint iCancelHint) throws ConnectException, AuthenticationException {
this.deleteApp(iCancelHint, null);
}
public void deleteApp(ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) throws ConnectException, AuthenticationException {
this.stopApp(iCancelHint, daemonSessionTaskListener);
this.getDaemonSession().sendMessage(new DeleteAppMessage(this.getAppTypeString(), this.getAppName()));
}
public void killAppAsync() throws ConnectException, AuthenticationException {
this.setAppStatus(BStationStatus.stopping);
this.getDaemonSession().sendMessage(new KillAppMessage(this.getAppTypeString(), this.getAppName()));
}
/*
* 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 killApp(ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) throws ConnectException, AuthenticationException {
block13: {
CancelableDaemonSessionTask cancelableDaemonSessionTask;
block12: {
if (this.isAppStopped()) break block13;
cancelableDaemonSessionTask = null;
try {
try {
if (daemonSessionTaskListener != null) {
cancelableDaemonSessionTask = new CancelableDaemonSessionTask(lex, "AppSurrogate.killing.title", "AppSurrogate.killing.message", new Object[]{this.getAppName()}, iCancelHint);
daemonSessionTaskListener.taskStarted(cancelableDaemonSessionTask);
}
this.killAppAsync();
this.poll();
while (!this.isAppStopped() && !BAppSurrogate.isCanceled(cancelableDaemonSessionTask)) {
Thread.sleep(1000L);
this.poll();
}
}
catch (ConnectException connectException) {
throw connectException;
}
catch (AuthenticationException authenticationException) {
throw authenticationException;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
catch (Throwable throwable) {
Object var5_9 = null;
if (daemonSessionTaskListener != null && cancelableDaemonSessionTask != null) {
daemonSessionTaskListener.taskFinished(cancelableDaemonSessionTask);
}
throw throwable;
}
{
Object var5_10 = null;
if (daemonSessionTaskListener == null || cancelableDaemonSessionTask == null) break block12;
daemonSessionTaskListener.taskFinished(cancelableDaemonSessionTask);
}
}
if (BAppSurrogate.isCanceled(cancelableDaemonSessionTask)) {
throw new ICancelHint.CanceledException();
}
}
}
public boolean isAppRunning() {
boolean bl = false;
if (this.getAppStatus() == BStationStatus.running || this.getAppStatus() == BStationStatus.starting) {
bl = true;
}
return bl;
}
public boolean isAppStopped() {
boolean bl = false;
if (this.getAppStatus() == BStationStatus.idle || this.getAppStatus() == BStationStatus.halted || this.getAppStatus() == BStationStatus.failed) {
bl = true;
}
return bl;
}
protected static boolean isCanceled(CancelableDaemonSessionTask cancelableDaemonSessionTask) {
boolean bl = false;
if (cancelableDaemonSessionTask != null) {
bl = cancelableDaemonSessionTask.isCanceled();
}
return bl;
}
public String toString(Context context) {
return lex.getText("AppSurrogate." + this.getAppTypeString() + ".display", new Object[]{this.getAppName()});
}
public BIcon getIcon() {
return this.isAppRunning() ? connectedIcon : disconnectedIcon;
}
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 BAppSurrogate() {
throw new UnsupportedOperationException();
}
public BAppSurrogate(BDaemonSession bDaemonSession) {
this.session = bDaemonSession;
}
static {
Class clazz = class$com$tridium$platform$daemon$BAppSurrogate;
if (clazz == null) {
clazz = class$com$tridium$platform$daemon$BAppSurrogate = BAppSurrogate.class("[Lcom.tridium.platform.daemon.BAppSurrogate;", false);
}
TYPE = Sys.loadType((Class)clazz);
connectedIcon = BIcon.std((String)"database.png");
disconnectedIcon = BIcon.std((String)"databaseDisconnected.png");
lex = Lexicon.make((String)"platform");
log = Log.getLog((String)"platform.appSurrogate");
}
protected static class GetAppOutputMessage
extends DaemonMessage {
private StringBuffer path;
public String getMessageString() {
return this.path.toString();
}
public GetAppOutputMessage(String string, String string2, boolean bl, boolean bl2) {
this.path = new StringBuffer(string);
this.path.append("?action=getoutput");
this.path.append("&").append(string).append("=").append(HttpUtil.encodeUrl((String)string2));
this.path.append("&follow=").append(String.valueOf(bl));
this.path.append("&updatesonly=").append(String.valueOf(bl2));
}
}
protected static class UpdateLogBufferSizeMessage
extends XmlResponseMessage {
private StringBuffer path;
public String getMessageString() {
return this.path.toString();
}
public UpdateLogBufferSizeMessage(String string, String string2, int n, int n2, boolean bl) {
this.path = new StringBuffer(string);
this.path.append("?action=update");
this.path.append("&").append(string).append("=").append(HttpUtil.encodeUrl((String)string2));
this.path.append("&logbuffersize=").append(n);
this.path.append("&logbufferfilesize=").append(n2);
if (bl) {
this.path.append("&save=true");
}
}
}
protected static class StartAppMessage
extends XmlResponseMessage {
private StringBuffer path;
public String getMessageString() {
return this.path.toString();
}
public StartAppMessage(String string, String string2) {
this.path = new StringBuffer(string);
this.path.append("?action=start");
this.path.append("&").append(string).append("=").append(HttpUtil.encodeUrl((String)string2));
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
protected static class OutputWatcher
extends Thread {
private InputStream in;
private CancelableDaemonSessionTask task;
private DaemonSessionTaskListener listener;
private boolean stopped;
private StringBuffer buf;
/*
* 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 run() {
if (this.listener == null) {
return;
}
this.stopped = false;
byte[] byArray = new byte[1024];
int n = 0;
try {
try {
this.checkCanceled();
while (!this.stopped) {
try {
n = this.in.read(byArray, 0, 1024);
}
catch (NullPointerException nullPointerException) {
throw new IOException();
}
catch (InterruptedIOException interruptedIOException) {
this.checkCanceled();
continue;
}
this.checkCanceled();
if (this.stopped) continue;
if (n >= 0) {
this.append(new String(byArray, 0, n));
continue;
}
this.stopWatcher(false);
}
}
catch (EOFException eOFException) {
String string = "\n" + lex.getText("InputStreamPane.eof");
this.append(string.getBytes(), 0, string.length());
}
catch (IOException iOException) {
if (!this.stopped) {
iOException.printStackTrace(System.out);
}
}
}
catch (Throwable throwable) {
Object var4_9 = null;
this.stopWatcher(false);
throw throwable;
}
{
Object var4_10 = null;
this.stopWatcher(false);
return;
}
}
public void append(Throwable throwable) {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
throwable.printStackTrace(new PrintStream(byteArrayOutputStream));
this.append(byteArrayOutputStream.toString());
}
public void append(byte[] byArray, int n, int n2) {
this.append(new String(byArray, n, n2));
}
public synchronized void append(String string) {
this.buf.append(string);
int n = -1;
while ((n = this.indexOf(this.buf, '\n')) >= 0) {
this.task.setMessage(this.buf.substring(0, n));
this.listener.taskUpdated(this.task);
this.buf.delete(0, n + 1);
}
}
private final synchronized int indexOf(StringBuffer stringBuffer, char c) {
int n = stringBuffer.length();
int n2 = 0;
while (n2 < n) {
if (stringBuffer.charAt(n2) == c) {
return n2;
}
++n2;
}
return -1;
}
public void stopWatcher() {
this.stopWatcher(true);
}
public void stopWatcher(boolean bl) {
if (this.stopped) {
return;
}
this.stopped = true;
try {
this.in.close();
}
catch (Exception exception) {
exception.printStackTrace();
}
if (bl) {
try {
this.join();
}
catch (Exception exception) {
exception.printStackTrace();
}
}
}
private final void checkCanceled() {
if (this.task != null && this.task.isCanceled()) {
this.stopWatcher(false);
}
}
private final /* synthetic */ void this() {
this.stopped = true;
this.buf = new StringBuffer();
}
public OutputWatcher(InputStream inputStream, CancelableDaemonSessionTask cancelableDaemonSessionTask, DaemonSessionTaskListener daemonSessionTaskListener) {
super("AppSurrogate:OutputWatcher");
this.this();
this.in = inputStream;
this.task = cancelableDaemonSessionTask;
this.listener = daemonSessionTaskListener;
}
}
protected static class StopAppMessage
extends XmlResponseMessage {
private StringBuffer path;
public String getMessageString() {
return this.path.toString();
}
public StopAppMessage(String string, String string2) {
this.path = new StringBuffer(string);
this.path.append("?action=stop");
this.path.append("&").append(string).append("=").append(HttpUtil.encodeUrl((String)string2));
this.path.append("&restartOverride=").append(2);
}
}
protected static class RestartAppMessage
extends XmlResponseMessage {
private StringBuffer path;
public String getMessageString() {
return this.path.toString();
}
public RestartAppMessage(String string, String string2, boolean bl) {
this.path = new StringBuffer(string);
if (bl) {
this.path.append("?action=kill");
} else {
this.path.append("?action=stop");
}
this.path.append("&").append(string).append("=").append(HttpUtil.encodeUrl((String)string2));
this.path.append("&restartOverride=").append(1);
}
}
protected static class KillAppMessage
extends XmlResponseMessage {
private StringBuffer path;
public String getMessageString() {
return this.path.toString();
}
public KillAppMessage(String string, String string2) {
this(string, string2, false);
}
public KillAppMessage(String string, String string2, boolean bl) {
this.path = new StringBuffer(string);
this.path.append("?action=kill");
this.path.append("&").append(string).append("=").append(HttpUtil.encodeUrl((String)string2));
this.path.append("&restartOverride=").append(2);
this.path.append("&block=").append(String.valueOf(bl));
}
}
}
@@ -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 com.tridium.platform.daemon;
import javax.baja.sys.BFrozenEnum;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public final class BDaemonAccessLevel
extends BFrozenEnum {
public static final int NONE = 0;
public static final int RESTRICTED = 1;
public static final int FULL = 2;
public static final BDaemonAccessLevel none = new BDaemonAccessLevel(0);
public static final BDaemonAccessLevel restricted = new BDaemonAccessLevel(1);
public static final BDaemonAccessLevel full = new BDaemonAccessLevel(2);
public static final Type TYPE;
public static final BDaemonAccessLevel DEFAULT;
static /* synthetic */ Class class$com$tridium$platform$daemon$BDaemonAccessLevel;
public final Type getType() {
return TYPE;
}
public static final BDaemonAccessLevel make(int n) {
return (BDaemonAccessLevel)none.getRange().get(n, false);
}
public static final BDaemonAccessLevel make(String string) {
return (BDaemonAccessLevel)none.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 BDaemonAccessLevel(int n) {
super(n);
}
static {
Class clazz = class$com$tridium$platform$daemon$BDaemonAccessLevel;
if (clazz == null) {
clazz = class$com$tridium$platform$daemon$BDaemonAccessLevel = BDaemonAccessLevel.class("[Lcom.tridium.platform.daemon.BDaemonAccessLevel;", false);
}
TYPE = Sys.loadType((Class)clazz);
DEFAULT = none;
}
}
@@ -0,0 +1,259 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.naming.BHost
* javax.baja.naming.BOrd
* javax.baja.naming.BOrdScheme
* javax.baja.naming.InvalidOrdBaseException
* javax.baja.naming.OrdQuery
* javax.baja.naming.OrdQueryList
* javax.baja.naming.OrdTarget
* javax.baja.naming.SyntaxException
* javax.baja.naming.UnresolvedException
* javax.baja.nre.util.TextUtil
* javax.baja.security.AuthenticationException
* javax.baja.sys.BObject
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform.daemon;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.DaemonSSLRequiredException;
import java.util.StringTokenizer;
import javax.baja.naming.BHost;
import javax.baja.naming.BOrd;
import javax.baja.naming.BOrdScheme;
import javax.baja.naming.InvalidOrdBaseException;
import javax.baja.naming.OrdQuery;
import javax.baja.naming.OrdQueryList;
import javax.baja.naming.OrdTarget;
import javax.baja.naming.SyntaxException;
import javax.baja.naming.UnresolvedException;
import javax.baja.nre.util.TextUtil;
import javax.baja.security.AuthenticationException;
import javax.baja.sys.BObject;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BDaemonScheme
extends BOrdScheme {
private static final String HTTPS_PREFIX = "https://";
public static final BDaemonScheme INSTANCE = new BDaemonScheme();
public static final int DEFAULT_PORT = 3011;
public static final int DEFAULT_SSL_PORT = 5011;
public static final Type TYPE;
static /* synthetic */ Class class$com$tridium$platform$daemon$BDaemonScheme;
public OrdQuery parse(String string) {
return new DaemonQuery(string);
}
public OrdTarget resolve(OrdTarget ordTarget, OrdQuery ordQuery) throws SyntaxException, UnresolvedException {
if (!(ordTarget.get() instanceof BHost)) {
throw new InvalidOrdBaseException();
}
BHost bHost = (BHost)ordTarget.get();
DaemonQuery daemonQuery = (DaemonQuery)ordQuery;
int n = daemonQuery.port;
String[] stringArray = daemonQuery.tunnelAuthorities;
BDaemonSession bDaemonSession = null;
try {
bDaemonSession = BDaemonSession.make(bHost, n, stringArray);
bDaemonSession.connect();
}
catch (DaemonSSLRequiredException daemonSSLRequiredException) {
BOrd bOrd;
if (bDaemonSession != null) {
bDaemonSession.close();
}
if ((bOrd = BDaemonScheme.convert(bHost, daemonSSLRequiredException.getNewLocation())) != null) {
return bOrd.resolve();
}
}
catch (AuthenticationException authenticationException) {
throw authenticationException;
}
catch (Exception exception) {
throw new UnresolvedException(ordQuery.toString(), (Throwable)exception);
}
return new OrdTarget(ordTarget, (BObject)bDaemonSession);
}
public static BOrd convert(BHost bHost, String string) {
if (string.startsWith(HTTPS_PREFIX)) {
String string2 = string.substring(HTTPS_PREFIX.length());
StringTokenizer stringTokenizer = new StringTokenizer(string2, ":");
String string3 = null;
string2 = stringTokenizer.nextToken();
if (stringTokenizer.hasMoreTokens()) {
string3 = stringTokenizer.nextToken();
return BDaemonScheme.createSSLOrd(bHost.getAbsoluteOrd(), string3);
}
}
return null;
}
private static final BOrd createSSLOrd(BOrd bOrd, String string) {
int n = 0;
n = string.indexOf("/");
if (n > 0) {
string = string.substring(0, n);
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(bOrd.toString()).append("|platformssl:");
if (string != null && string.length() > 0) {
stringBuffer.append(string);
}
String string2 = stringBuffer.toString();
return BOrd.make((String)string2);
}
return null;
}
static String[] validateAuthorities(String[] stringArray) {
if (stringArray == null) {
return null;
}
int n = stringArray.length;
if (n < 1) {
return null;
}
String[] stringArray2 = new String[n];
int n2 = 0;
int n3 = 0;
while (n3 < n) {
if (stringArray[n3] != null && !stringArray[n3].equals("")) {
stringArray2[n2] = stringArray[n3];
++n2;
}
++n3;
}
String[] stringArray3 = new String[n2];
System.arraycopy(stringArray2, 0, stringArray3, 0, n2);
return stringArray3;
}
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 BDaemonScheme() {
super("platform");
}
static {
Class clazz = class$com$tridium$platform$daemon$BDaemonScheme;
if (clazz == null) {
clazz = class$com$tridium$platform$daemon$BDaemonScheme = BDaemonScheme.class("[Lcom.tridium.platform.daemon.BDaemonScheme;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public static class DaemonQuery
implements OrdQuery {
int port;
String[] tunnelAuthorities;
public boolean isHost() {
return false;
}
public boolean isSession() {
return true;
}
public void normalize(OrdQueryList ordQueryList, int n) {
ordQueryList.shiftToHost(n);
}
public String getScheme() {
return "platform";
}
public String getBody() {
StringBuffer stringBuffer = new StringBuffer();
if (this.port != this.getDefaultPort()) {
stringBuffer.append(String.valueOf(this.port));
}
if (this.tunnelAuthorities != null) {
int n = 0;
while (n < this.tunnelAuthorities.length) {
if (this.tunnelAuthorities[n] != null && !this.tunnelAuthorities[n].equals("")) {
stringBuffer.append("/").append(this.tunnelAuthorities[n]);
}
++n;
}
}
return stringBuffer.toString();
}
public String toString() {
return "platform:" + this.getBody();
}
public int getDefaultPort() {
return 3011;
}
public int getPort() {
return this.port;
}
public String[] getTunnelAuthorities() {
return this.tunnelAuthorities;
}
private final /* synthetic */ void this() {
this.tunnelAuthorities = null;
}
protected DaemonQuery(String string) {
this.this();
string = string.trim();
if (string.length() == 0) {
this.port = this.getDefaultPort();
} else {
int n = string.indexOf(47);
if (n >= 0) {
this.port = n == 0 ? this.getDefaultPort() : Integer.parseInt(string.substring(0, n));
string = string.substring(n);
this.tunnelAuthorities = BDaemonScheme.validateAuthorities(TextUtil.splitAndTrim((String)string, (char)'/'));
} else {
this.port = Integer.parseInt(string);
}
}
}
protected DaemonQuery(int n) {
this.this();
this.port = n;
}
protected DaemonQuery(int n, String[] stringArray) {
this.this();
this.port = n;
this.tunnelAuthorities = BDaemonScheme.validateAuthorities(stringArray);
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,716 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.naming.SlotPath
* javax.baja.sys.BComplex
* javax.baja.sys.BComponent
* javax.baja.sys.BRelTime
* javax.baja.sys.BString
* javax.baja.sys.BValue
* javax.baja.sys.BVector
* javax.baja.sys.Property
* javax.baja.sys.Sys
* javax.baja.sys.Topic
* javax.baja.sys.Type
* javax.baja.xml.XElem
*/
package com.tridium.platform.daemon;
import com.tridium.install.part.BGenericPart;
import com.tridium.platform.BFilesystemAttributes;
import com.tridium.platform.BPlatformSSLSettings;
import com.tridium.platform.daemon.BDaemonAccessLevel;
import com.tridium.platform.daemon.BModuleContent;
import com.tridium.platform.ewf.BEwfBootCommand;
import com.tridium.platform.ewf.BEwfEnableState;
import com.tridium.platform.ewf.BEwfOverlayAttributes;
import com.tridium.platform.timezone.BDstSupportLevel;
import javax.baja.naming.SlotPath;
import javax.baja.sys.BComplex;
import javax.baja.sys.BComponent;
import javax.baja.sys.BRelTime;
import javax.baja.sys.BString;
import javax.baja.sys.BValue;
import javax.baja.sys.BVector;
import javax.baja.sys.Property;
import javax.baja.sys.Sys;
import javax.baja.sys.Topic;
import javax.baja.sys.Type;
import javax.baja.xml.XElem;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BHostProperties
extends BComponent {
public static final Property hostId = BHostProperties.newProperty((int)3, (String)"", null);
public static final Property brandId = BHostProperties.newProperty((int)3, (String)"", null);
public static final Property sessionTimestamp = BHostProperties.newProperty((int)3, (String)"", null);
public static final Property moduleContent = BHostProperties.newProperty((int)3, (BValue)BModuleContent.doc, null);
public static final Property httpPort = BHostProperties.newProperty((int)3, (int)-1, null);
public static final Property stripLineNumbers = BHostProperties.newProperty((int)3, (boolean)false, null);
public static final Property hostArch = BHostProperties.newProperty((int)3, (String)"unknown", null);
public static final Property modelName = BHostProperties.newProperty((int)3, (String)"unknown", null);
public static final Property osCrcText = BHostProperties.newProperty((int)3, (String)"-1", null);
public static final Property osName = BHostProperties.newProperty((int)3, (String)"unknown", null);
public static final Property osDesc = BHostProperties.newProperty((int)3, (String)"unknown", null);
public static final Property osVersion = BHostProperties.newProperty((int)3, (String)"", null);
public static final Property osInstallable = BHostProperties.newProperty((int)3, (boolean)false, null);
public static final Property nrePartName = BHostProperties.newProperty((int)3, (String)"unknown", null);
public static final Property nrePartDesc = BHostProperties.newProperty((int)3, (String)"unknown", null);
public static final Property nrePartVersion = BHostProperties.newProperty((int)3, (String)"", null);
public static final Property vmName = BHostProperties.newProperty((int)3, (String)"unknown", null);
public static final Property vmVendor = BHostProperties.newProperty((int)3, (String)"unknown", null);
public static final Property vmVersion = BHostProperties.newProperty((int)3, (String)"", null);
public static final Property isVmUnspecified = BHostProperties.newProperty((int)3, (boolean)false, null);
public static final Property parts = BHostProperties.newProperty((int)3, (BValue)new BVector(), null);
public static final Property isDirty = BHostProperties.newProperty((int)3, (boolean)true, null);
public static final Property servletNames = BHostProperties.newProperty((int)3, (BValue)new BVector(), null);
public static final Property maxStations = BHostProperties.newProperty((int)3, (int)1, null);
public static final Property maxSedonaApps = BHostProperties.newProperty((int)3, (int)1, null);
public static final Property numCpus = BHostProperties.newProperty((int)3, (int)1, null);
public static final Property currentCpuUsage = BHostProperties.newProperty((int)3, (int)-1, null);
public static final Property overallCpuUsage = BHostProperties.newProperty((int)3, (int)-1, null);
public static final Property totalPhysicalMemory = BHostProperties.newProperty((int)3, (int)-1, null);
public static final Property freePhysicalMemory = BHostProperties.newProperty((int)3, (int)-1, null);
public static final Property filesystemAttributes = BHostProperties.newProperty((int)3, (BValue)new BVector(), null);
public static final Property timezoneDayModeSupport = BHostProperties.newProperty((int)3, (BValue)BDstSupportLevel.none, null);
public static final Property accessLevel = BHostProperties.newProperty((int)3, (BValue)BDaemonAccessLevel.restricted, null);
public static final Property allowStationRestart = BHostProperties.newProperty((int)3, (boolean)true, null);
public static final Property failureRebootLimit = BHostProperties.newProperty((int)3, (int)3, null);
public static final Property failureRebootLimitPeriod = BHostProperties.newProperty((int)3, (BValue)BRelTime.HOUR, null);
public static final Property ewfOverlays = BHostProperties.newProperty((int)3, (BValue)new BVector(), null);
public static final Property configDistFileName = BHostProperties.newProperty((int)3, (String)"nre-config-*.dist", null);
public static final Property isNpsdk = BHostProperties.newProperty((int)3, (boolean)false, null);
public static final Property sedonaSupported = BHostProperties.newProperty((int)3, (boolean)false, null);
public static final Property sedonaEnabled = BHostProperties.newProperty((int)3, (boolean)false, null);
public static final Property niagaraStationsEnabled = BHostProperties.newProperty((int)3, (boolean)true, null);
public static final Property niagaraR2Supported = BHostProperties.newProperty((int)3, (boolean)false, null);
public static final Property niagaraR2Enabled = BHostProperties.newProperty((int)3, (boolean)false, null);
public static final Property sslSupported = BHostProperties.newProperty((int)3, (boolean)false, null);
public static final Property sslSettings = BHostProperties.newProperty((int)3, (BValue)new BPlatformSSLSettings(), null);
public static final Topic hostPropertiesChanged = BHostProperties.newTopic((int)0, null);
public static final Type TYPE;
static /* synthetic */ Class class$com$tridium$platform$daemon$BHostProperties;
public String getHostId() {
return this.getString(hostId);
}
public void setHostId(String string) {
this.setString(hostId, string, null);
}
public String getBrandId() {
return this.getString(brandId);
}
public void setBrandId(String string) {
this.setString(brandId, string, null);
}
public String getSessionTimestamp() {
return this.getString(sessionTimestamp);
}
public void setSessionTimestamp(String string) {
this.setString(sessionTimestamp, string, null);
}
public BModuleContent getModuleContent() {
return (BModuleContent)this.get(moduleContent);
}
public void setModuleContent(BModuleContent bModuleContent) {
this.set(moduleContent, (BValue)bModuleContent, null);
}
public int getHttpPort() {
return this.getInt(httpPort);
}
public void setHttpPort(int n) {
this.setInt(httpPort, n, null);
}
public boolean getStripLineNumbers() {
return this.getBoolean(stripLineNumbers);
}
public void setStripLineNumbers(boolean bl) {
this.setBoolean(stripLineNumbers, bl, null);
}
public String getHostArch() {
return this.getString(hostArch);
}
public void setHostArch(String string) {
this.setString(hostArch, string, null);
}
public String getModelName() {
return this.getString(modelName);
}
public void setModelName(String string) {
this.setString(modelName, string, null);
}
public String getOsCrcText() {
return this.getString(osCrcText);
}
public void setOsCrcText(String string) {
this.setString(osCrcText, string, null);
}
public String getOsName() {
return this.getString(osName);
}
public void setOsName(String string) {
this.setString(osName, string, null);
}
public String getOsDesc() {
return this.getString(osDesc);
}
public void setOsDesc(String string) {
this.setString(osDesc, string, null);
}
public String getOsVersion() {
return this.getString(osVersion);
}
public void setOsVersion(String string) {
this.setString(osVersion, string, null);
}
public boolean getOsInstallable() {
return this.getBoolean(osInstallable);
}
public void setOsInstallable(boolean bl) {
this.setBoolean(osInstallable, bl, null);
}
public String getNrePartName() {
return this.getString(nrePartName);
}
public void setNrePartName(String string) {
this.setString(nrePartName, string, null);
}
public String getNrePartDesc() {
return this.getString(nrePartDesc);
}
public void setNrePartDesc(String string) {
this.setString(nrePartDesc, string, null);
}
public String getNrePartVersion() {
return this.getString(nrePartVersion);
}
public void setNrePartVersion(String string) {
this.setString(nrePartVersion, string, null);
}
public String getVmName() {
return this.getString(vmName);
}
public void setVmName(String string) {
this.setString(vmName, string, null);
}
public String getVmVendor() {
return this.getString(vmVendor);
}
public void setVmVendor(String string) {
this.setString(vmVendor, string, null);
}
public String getVmVersion() {
return this.getString(vmVersion);
}
public void setVmVersion(String string) {
this.setString(vmVersion, string, null);
}
public boolean getIsVmUnspecified() {
return this.getBoolean(isVmUnspecified);
}
public void setIsVmUnspecified(boolean bl) {
this.setBoolean(isVmUnspecified, bl, null);
}
public BVector getParts() {
return (BVector)this.get(parts);
}
public void setParts(BVector bVector) {
this.set(parts, (BValue)bVector, null);
}
public boolean getIsDirty() {
return this.getBoolean(isDirty);
}
public void setIsDirty(boolean bl) {
this.setBoolean(isDirty, bl, null);
}
public BVector getServletNames() {
return (BVector)this.get(servletNames);
}
public void setServletNames(BVector bVector) {
this.set(servletNames, (BValue)bVector, null);
}
public int getMaxStations() {
return this.getInt(maxStations);
}
public void setMaxStations(int n) {
this.setInt(maxStations, n, null);
}
public int getMaxSedonaApps() {
return this.getInt(maxSedonaApps);
}
public void setMaxSedonaApps(int n) {
this.setInt(maxSedonaApps, n, null);
}
public int getNumCpus() {
return this.getInt(numCpus);
}
public void setNumCpus(int n) {
this.setInt(numCpus, n, null);
}
public int getCurrentCpuUsage() {
return this.getInt(currentCpuUsage);
}
public void setCurrentCpuUsage(int n) {
this.setInt(currentCpuUsage, n, null);
}
public int getOverallCpuUsage() {
return this.getInt(overallCpuUsage);
}
public void setOverallCpuUsage(int n) {
this.setInt(overallCpuUsage, n, null);
}
public int getTotalPhysicalMemory() {
return this.getInt(totalPhysicalMemory);
}
public void setTotalPhysicalMemory(int n) {
this.setInt(totalPhysicalMemory, n, null);
}
public int getFreePhysicalMemory() {
return this.getInt(freePhysicalMemory);
}
public void setFreePhysicalMemory(int n) {
this.setInt(freePhysicalMemory, n, null);
}
public BVector getFilesystemAttributes() {
return (BVector)this.get(filesystemAttributes);
}
public void setFilesystemAttributes(BVector bVector) {
this.set(filesystemAttributes, (BValue)bVector, null);
}
public BDstSupportLevel getTimezoneDayModeSupport() {
return (BDstSupportLevel)this.get(timezoneDayModeSupport);
}
public void setTimezoneDayModeSupport(BDstSupportLevel bDstSupportLevel) {
this.set(timezoneDayModeSupport, (BValue)bDstSupportLevel, null);
}
public BDaemonAccessLevel getAccessLevel() {
return (BDaemonAccessLevel)this.get(accessLevel);
}
public void setAccessLevel(BDaemonAccessLevel bDaemonAccessLevel) {
this.set(accessLevel, (BValue)bDaemonAccessLevel, null);
}
public boolean getAllowStationRestart() {
return this.getBoolean(allowStationRestart);
}
public void setAllowStationRestart(boolean bl) {
this.setBoolean(allowStationRestart, bl, null);
}
public int getFailureRebootLimit() {
return this.getInt(failureRebootLimit);
}
public void setFailureRebootLimit(int n) {
this.setInt(failureRebootLimit, n, null);
}
public BRelTime getFailureRebootLimitPeriod() {
return (BRelTime)this.get(failureRebootLimitPeriod);
}
public void setFailureRebootLimitPeriod(BRelTime bRelTime) {
this.set(failureRebootLimitPeriod, (BValue)bRelTime, null);
}
public BVector getEwfOverlays() {
return (BVector)this.get(ewfOverlays);
}
public void setEwfOverlays(BVector bVector) {
this.set(ewfOverlays, (BValue)bVector, null);
}
public String getConfigDistFileName() {
return this.getString(configDistFileName);
}
public void setConfigDistFileName(String string) {
this.setString(configDistFileName, string, null);
}
public boolean getIsNpsdk() {
return this.getBoolean(isNpsdk);
}
public void setIsNpsdk(boolean bl) {
this.setBoolean(isNpsdk, bl, null);
}
public boolean getSedonaSupported() {
return this.getBoolean(sedonaSupported);
}
public void setSedonaSupported(boolean bl) {
this.setBoolean(sedonaSupported, bl, null);
}
public boolean getSedonaEnabled() {
return this.getBoolean(sedonaEnabled);
}
public void setSedonaEnabled(boolean bl) {
this.setBoolean(sedonaEnabled, bl, null);
}
public boolean getNiagaraStationsEnabled() {
return this.getBoolean(niagaraStationsEnabled);
}
public void setNiagaraStationsEnabled(boolean bl) {
this.setBoolean(niagaraStationsEnabled, bl, null);
}
public boolean getNiagaraR2Supported() {
return this.getBoolean(niagaraR2Supported);
}
public void setNiagaraR2Supported(boolean bl) {
this.setBoolean(niagaraR2Supported, bl, null);
}
public boolean getNiagaraR2Enabled() {
return this.getBoolean(niagaraR2Enabled);
}
public void setNiagaraR2Enabled(boolean bl) {
this.setBoolean(niagaraR2Enabled, bl, null);
}
public boolean getSslSupported() {
return this.getBoolean(sslSupported);
}
public void setSslSupported(boolean bl) {
this.setBoolean(sslSupported, bl, null);
}
public BPlatformSSLSettings getSslSettings() {
return (BPlatformSSLSettings)this.get(sslSettings);
}
public void setSslSettings(BPlatformSSLSettings bPlatformSSLSettings) {
this.set(sslSettings, (BValue)bPlatformSSLSettings, null);
}
public void fireHostPropertiesChanged(BValue bValue) {
this.fire(hostPropertiesChanged, bValue, null);
}
public Type getType() {
return TYPE;
}
public String getPartDescription(String string) {
BValue bValue = this.getParts().loadSlots().get(string);
return bValue == null ? null : bValue.toString();
}
public boolean hasFullAccess() {
boolean bl = false;
if (this.getAccessLevel() == BDaemonAccessLevel.full) {
bl = true;
}
return bl;
}
public long getOsCrc() {
return Long.parseLong(this.getOsCrcText());
}
public void reset() {
this.getParts().removeAll();
this.getServletNames().removeAll();
this.copyFrom((BComplex)new BHostProperties());
}
public void checkTimestamp(String string) {
if (!this.getSessionTimestamp().equals(string)) {
this.reset();
this.setSessionTimestamp(string);
}
}
public void loadServletsInfo(XElem xElem) throws Exception {
this.getServletNames().removeAll();
this.setAccessLevel(BDaemonAccessLevel.restricted);
XElem[] xElemArray = xElem.elems("servlet");
int n = 0;
while (n < xElemArray.length) {
String string = xElemArray[n].get("name");
this.getServletNames().add(string, (BValue)BString.make((String)string));
if (string.equals("reboot")) {
this.setAccessLevel(BDaemonAccessLevel.full);
}
++n;
}
}
public boolean supportsServlet(String string) {
boolean bl = false;
if (this.getServletNames().getProperty(string) != null) {
bl = true;
}
return bl;
}
public void load(XElem xElem) throws Exception {
XElem xElem2;
boolean bl;
Object object;
XElem xElem3;
this.removeAll();
this.setHostId(xElem.get("hostId"));
this.setHttpPort(xElem.geti("httpPort", -1));
String string = xElem.get("brandId", "noBrand");
if (string.trim().length() == 0) {
string = "noBrand";
}
this.setBrandId(string);
String string2 = xElem.get("moduleContent", null);
if (string2 == null) {
string2 = xElem.get("installFlag", null);
}
if (string2 == null) {
string2 = xElem.getb("embedded", false) ? "runtime" : "doc";
}
this.setModuleContent(BModuleContent.make(string2));
if (xElem.get("stripLineNumbers", null) != null) {
this.setStripLineNumbers(xElem.getb("stripLineNumbers", false));
} else {
this.setStripLineNumbers(xElem.getb("embedded", false));
}
if (xElem.get("maxStations", null) != null) {
this.setMaxStations(xElem.geti("maxStations", 32));
} else if (xElem.getb("embedded", false)) {
this.setMaxStations(1);
} else {
this.setMaxStations(32);
}
if (xElem.get("maxSedonaApps", null) != null) {
this.setMaxSedonaApps(xElem.geti("maxSedonaApps", (int)((char)-1)));
} else if (xElem.getb("embedded", false)) {
this.setMaxSedonaApps(1);
} else {
this.setMaxSedonaApps((char)-1);
}
this.setFailureRebootLimit(xElem.geti("failureRebootLimit", 3));
if (xElem.get("failureRebootLimitPeriod", null) != null) {
this.setFailureRebootLimitPeriod(BRelTime.make((long)xElem.getl("failureRebootLimitPeriod")));
} else {
this.setFailureRebootLimitPeriod(BRelTime.HOUR);
}
this.setConfigDistFileName(xElem.get("configDistFileName", "nre-config-*.dist"));
this.setIsNpsdk(xElem.getb("npsdk", false));
this.setSedonaSupported(xElem.getb("sedonaSupported", false));
this.setSedonaEnabled(xElem.getb("sedonaEnabled", false));
this.setNiagaraStationsEnabled(xElem.getb("niagaraStationsEnabled", true));
this.setNiagaraR2Supported(xElem.getb("niagaraR2Supported", false));
this.setNiagaraR2Enabled(xElem.getb("niagaraR2Enabled", false));
String string3 = xElem.get("arch", null);
if (string3 != null) {
if (string3.equals("amd64")) {
string3 = "x64";
}
this.setHostArch(string3);
}
if ((xElem3 = xElem.elem("vm")) != null) {
object = xElem3.get("name", null);
if (object == null || ((String)object).indexOf("Undetermined") != -1) {
this.setIsVmUnspecified(true);
} else {
this.setVmName((String)object);
this.setVmVendor(xElem3.get("vendor", "unknown"));
this.setVmVersion(xElem3.get("version", ""));
}
}
if ((object = xElem.elem("os")) != null) {
this.setOsName(object.get("name", "unknown"));
string3 = object.get("arch", null);
if (string3 != null) {
this.setHostArch(string3);
}
this.setOsDesc(object.get("desc", "unknown"));
this.setOsVersion(object.get("version", ""));
this.setOsCrcText(object.get("crc", "-1"));
bl = this.getOsName().toLowerCase().startsWith("qnx");
this.setOsInstallable(object.getb("installable", bl));
}
bl = this.getOsName().toLowerCase().startsWith("win");
this.setAllowStationRestart(xElem.getb("allowStationRestart", bl));
XElem xElem4 = xElem.elem("nre");
if (xElem4 != null) {
this.setNrePartName(xElem4.get("name", "unknown"));
this.setNrePartDesc(xElem4.get("desc", "unknown"));
this.setNrePartVersion(xElem4.get("version", ""));
}
if ((xElem2 = xElem.elem("model")) != null) {
this.setModelName(xElem2.get("name", "unknown"));
}
this.getParts().removeAll();
XElem[] xElemArray = xElem.elems("part");
int n = 0;
while (n < xElemArray.length) {
this.getParts().add(SlotPath.escape((String)xElemArray[n].get("name")), (BValue)BGenericPart.make(xElemArray[n]));
++n;
}
this.update(xElem);
}
public void update(XElem xElem) {
XElem xElem2;
XElem xElem3;
Object object;
Object object2;
XElem xElem4;
XElem xElem5 = xElem.elem("filesystems");
if (xElem5 != null) {
xElem4 = xElem5.elems("filesystem");
int n = 0;
while (n < ((XElem)xElem4).length) {
object2 = SlotPath.escape((String)xElem4[n].get("name"));
object = (BFilesystemAttributes)this.getFilesystemAttributes().get((String)object2);
if (object == null) {
object = new BFilesystemAttributes(xElem4[n].getl("totalBytes") / 1024L, xElem4[n].getl("freeBytes") / 1024L, xElem4[n].geti("blockSize"), xElem4[n].getl("maxFileCount", (long)-1), xElem4[n].getl("currentFileCount", (long)-1), xElem4[n].getb("isFlash", false));
this.getFilesystemAttributes().add((String)object2, (BValue)object);
} else {
object.setTotalSpace(xElem4[n].getl("totalBytes") / 1024L);
object.setFreeSpace(xElem4[n].getl("freeBytes") / 1024L);
object.setBlockSize(xElem4[n].geti("blockSize"));
object.setMaxFileCount(xElem4[n].getl("maxFileCount", (long)-1));
object.setCurrentFileCount(xElem4[n].getl("currentFileCount", (long)-1));
object.setIsFlash(xElem4[n].getb("isFlash", false));
}
++n;
}
}
if ((xElem4 = xElem.elem("cpu")) != null) {
this.setCurrentCpuUsage(xElem4.geti("currentUtilization", -1));
this.setOverallCpuUsage(xElem4.geti("overallUtilization", -1));
this.setNumCpus(xElem4.geti("nCpus", 1));
}
if ((xElem3 = xElem.elem("physicalMemory")) != null) {
this.setTotalPhysicalMemory((int)(xElem3.getl("totalBytes") / 1024L));
this.setFreePhysicalMemory((int)(xElem3.getl("freeBytes") / 1024L));
}
if ((object2 = xElem.elem("tzSupport")) != null) {
this.setTimezoneDayModeSupport(BDstSupportLevel.make(object2.get("dayMode", "none")));
}
if ((object = xElem.elem("sslSupported")) != null) {
this.setSslSupported(true);
if (this.getSslSettings() == null) {
this.setSslSettings(new BPlatformSSLSettings());
}
this.getSslSettings().updateFromXml((XElem)object);
}
if ((xElem2 = xElem.elem("ewf")) != null) {
XElem[] xElemArray = xElem2.elems("overlay");
int n = 0;
while (n < xElemArray.length) {
String string = SlotPath.escape((String)xElemArray[n].get("drive"));
BEwfOverlayAttributes bEwfOverlayAttributes = (BEwfOverlayAttributes)this.getEwfOverlays().get(string);
if (bEwfOverlayAttributes == null) {
bEwfOverlayAttributes = new BEwfOverlayAttributes(BEwfEnableState.make(xElemArray[n].geti("state")), BEwfBootCommand.make(xElemArray[n].geti("command")), (double)xElemArray[n].getl("ramUsage") / 1048576.0);
this.getEwfOverlays().add(string, (BValue)bEwfOverlayAttributes);
} else {
bEwfOverlayAttributes.setEnableState(BEwfEnableState.make(xElemArray[n].geti("state")));
bEwfOverlayAttributes.setBootCommand(BEwfBootCommand.make(xElemArray[n].geti("command")));
bEwfOverlayAttributes.setRamUsage((double)xElemArray[n].getl("ramUsage") / 1048576.0);
}
++n;
}
}
this.fireHostPropertiesChanged(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());
}
}
static {
Class clazz = class$com$tridium$platform$daemon$BHostProperties;
if (clazz == null) {
clazz = class$com$tridium$platform$daemon$BHostProperties = BHostProperties.class("[Lcom.tridium.platform.daemon.BHostProperties;", 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 com.tridium.platform.daemon;
import javax.baja.sys.BFrozenEnum;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public final class BModuleContent
extends BFrozenEnum {
public static final int RUNTIME = 0;
public static final int UI = 1;
public static final int DOC = 2;
public static final BModuleContent runtime = new BModuleContent(0);
public static final BModuleContent ui = new BModuleContent(1);
public static final BModuleContent doc = new BModuleContent(2);
public static final Type TYPE;
public static final BModuleContent DEFAULT;
static /* synthetic */ Class class$com$tridium$platform$daemon$BModuleContent;
public final Type getType() {
return TYPE;
}
public static final BModuleContent make(int n) {
return (BModuleContent)runtime.getRange().get(n, false);
}
public static final BModuleContent make(String string) {
return (BModuleContent)runtime.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 BModuleContent(int n) {
super(n);
}
static {
Class clazz = class$com$tridium$platform$daemon$BModuleContent;
if (clazz == null) {
clazz = class$com$tridium$platform$daemon$BModuleContent = BModuleContent.class("[Lcom.tridium.platform.daemon.BModuleContent;", false);
}
TYPE = Sys.loadType((Class)clazz);
DEFAULT = runtime;
}
}
@@ -0,0 +1,486 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.net.HttpUtil
* javax.baja.file.BDirectory
* javax.baja.file.FilePath
* javax.baja.naming.BHost
* javax.baja.naming.BIpHost
* javax.baja.net.HttpConnection
* javax.baja.security.AuthenticationException
* javax.baja.security.BICredentials
* javax.baja.security.BUsernameAndPassword
* javax.baja.sys.BIcon
* javax.baja.sys.BajaRuntimeException
* javax.baja.sys.Property
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.xml.XElem
* javax.baja.xml.XParser
*/
package com.tridium.platform.daemon;
import com.tridium.net.HttpUtil;
import com.tridium.platform.daemon.Authenticator;
import com.tridium.platform.daemon.BAppSurrogate;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.DaemonFileUtil;
import com.tridium.platform.daemon.file.BDaemonDirectoryStore;
import com.tridium.platform.daemon.file.BDaemonFileStore;
import com.tridium.platform.daemon.file.StoreCache;
import com.tridium.platform.daemon.message.FileTransferMessage;
import com.tridium.platform.daemon.message.GetDirectoryMessage;
import com.tridium.platform.daemon.message.XmlResponseMessage;
import com.tridium.platform.daemon.task.CancelableDaemonSessionTask;
import com.tridium.platform.daemon.task.DaemonSessionTaskListener;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.ConnectException;
import javax.baja.file.BDirectory;
import javax.baja.file.FilePath;
import javax.baja.naming.BHost;
import javax.baja.naming.BIpHost;
import javax.baja.net.HttpConnection;
import javax.baja.platform.BStationStatus;
import javax.baja.platform.ICancelHint;
import javax.baja.security.AuthenticationException;
import javax.baja.security.BICredentials;
import javax.baja.security.BUsernameAndPassword;
import javax.baja.sys.BIcon;
import javax.baja.sys.BajaRuntimeException;
import javax.baja.sys.Property;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.xml.XElem;
import javax.baja.xml.XParser;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BR2StationSurrogate
extends BAppSurrogate {
public static final Property httpPort = BR2StationSurrogate.newProperty((int)3, (int)-1, null);
public static final Property dbFormat = BR2StationSurrogate.newProperty((int)3, (String)"n/a", null);
public static final Type TYPE;
protected static final BIcon connectedIcon;
protected static final BIcon disconnectedIcon;
static /* synthetic */ Class class$com$tridium$platform$daemon$BR2StationSurrogate;
public String getR2StationName() {
return this.getAppName();
}
public void setR2StationName(String string) {
this.setAppName(string);
}
public BStationStatus getR2StationStatus() {
return this.getAppStatus();
}
public void setR2StationStatus(BStationStatus bStationStatus) {
this.setAppStatus(bStationStatus);
}
public int getHttpPort() {
return this.getInt(httpPort);
}
public void setHttpPort(int n) {
this.setInt(httpPort, n, null);
}
public String getDbFormat() {
return this.getString(dbFormat);
}
public void setDbFormat(String string) {
this.setString(dbFormat, string, null);
}
public Type getType() {
return TYPE;
}
public static BR2StationSurrogate make(BDaemonSession bDaemonSession, String string) throws Exception {
BR2StationSurrogate bR2StationSurrogate = new BR2StationSurrogate(bDaemonSession);
bR2StationSurrogate.setAppName(string);
bR2StationSurrogate.poll();
return bR2StationSurrogate;
}
public static BR2StationSurrogate[] makeAll(BDaemonSession bDaemonSession) throws Exception {
return (BR2StationSurrogate[])BR2StationSurrogate.makeAll(TYPE, bDaemonSession);
}
public static boolean isAnyR2StationRunning(BDaemonSession bDaemonSession) throws Exception {
return BR2StationSurrogate.isAnyAppRunning(TYPE, bDaemonSession);
}
public void updateFields(XElem xElem) {
super.updateFields(xElem);
XElem xElem2 = xElem.elem("httpport");
if (xElem2 != null) {
this.setHttpPort(xElem2.geti("value"));
}
if ((xElem2 = xElem.elem("dbtype")) != null) {
this.setDbFormat(xElem2.get("value"));
}
}
public InputStream getR2StationOutput() throws ConnectException, AuthenticationException {
return this.getAppOutput(true, false);
}
public InputStream getR2StationOutput(boolean bl) throws ConnectException, AuthenticationException {
return this.getAppOutput(bl, false);
}
public InputStream getR2StationOutput(boolean bl, boolean bl2) throws ConnectException, AuthenticationException {
return this.getAppOutput(bl, bl2);
}
public BIcon getIcon() {
return this.isAppRunning() ? connectedIcon : disconnectedIcon;
}
public void dumpThreads() throws ConnectException, AuthenticationException {
this.getDaemonSession().sendMessage(new ThreadDumpMessage(this.getAppName()));
}
public boolean isR2StationRunning() {
return this.isAppRunning();
}
public boolean isR2StationStopped() {
return this.isAppStopped();
}
public void startR2StationAsync() throws ConnectException, AuthenticationException {
this.startAppAsync();
}
public void startR2Station(ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) throws Exception {
this.startApp(iCancelHint, daemonSessionTaskListener);
}
public static BR2StationSurrogate[] stopAllR2Stations(BDaemonSession bDaemonSession, ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) throws Exception {
return (BR2StationSurrogate[])BR2StationSurrogate.stopAllApps(bDaemonSession, TYPE, BR2StationSurrogate.makeAll(bDaemonSession), iCancelHint, daemonSessionTaskListener);
}
public static BR2StationSurrogate[] stopAllR2Stations(BDaemonSession bDaemonSession, BR2StationSurrogate[] bR2StationSurrogateArray, ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) throws Exception {
return (BR2StationSurrogate[])BR2StationSurrogate.stopAllApps(bDaemonSession, TYPE, bR2StationSurrogateArray, iCancelHint, daemonSessionTaskListener);
}
public void saveStation(BUsernameAndPassword bUsernameAndPassword) throws ConnectException, AuthenticationException {
boolean bl;
long l;
long l2;
HttpConnection httpConnection;
BR2StationSurrogate bR2StationSurrogate;
block22: {
if (this.getAppStatus() != BStationStatus.running) {
return;
}
bR2StationSurrogate = this;
String string = bR2StationSurrogate.getDbFormat();
int n = bR2StationSurrogate.getHttpPort();
String string2 = bR2StationSurrogate.getDaemonSession().getRemoteAddressString();
String string3 = bR2StationSurrogate.getAppName();
String string4 = "/prism/backupLocal?format=" + string;
BIpHost bIpHost = new BIpHost(string2);
httpConnection = null;
Authenticator authenticator = null;
boolean bl2 = false;
l2 = -1;
l = -1;
try {
XElem xElem = XParser.make((InputStream)this.getDaemonSession().getInputStream(new GetDirectoryMessage(new FilePath("/niagara/niagaraR2/rel/stations/" + this.getAppName()), false, true, false, bR2StationSurrogate.getDaemonSession().getFileSpace()))).parse();
XElem[] xElemArray = xElem.elems("file");
XElem xElem2 = null;
int n2 = 0;
while (n2 < xElemArray.length) {
if (xElemArray[n2].get("name").equalsIgnoreCase("config.sns")) {
xElem2 = xElemArray[n2];
break;
}
++n2;
}
if (xElem2 != null) {
BDaemonFileStore bDaemonFileStore = new BDaemonFileStore(bR2StationSurrogate.getDaemonSession().getFileSpace(), new FilePath("/niagara/niagaraR2/rel/stations/" + this.getAppName() + "/config.sns"), xElem2);
l2 = bDaemonFileStore.getCrc();
l = bDaemonFileStore.getLastModified().getMillis();
}
}
catch (Exception exception) {}
bl = false;
while (true) {
try {
int n3 = 0;
if (httpConnection == null) {
httpConnection = new HttpConnection((BHost)bIpHost, n, string4);
n3 = httpConnection.connect();
} else {
bl2 = authenticator == null ? false : authenticator.setAuthorization(httpConnection, string4);
n3 = httpConnection.newRequest(string4);
}
if (n3 != 401) break;
this.readFully(httpConnection);
if (bl2) {
throw new AuthenticationException(this.getLexicon().getText("R2StationSurrogate.command.saveStation.invalidCredentials"));
}
authenticator = Authenticator.make(authenticator, (BHost)bIpHost, n, string3, httpConnection);
authenticator.setCredentials((BICredentials)bUsernameAndPassword);
}
catch (IOException iOException) {
break block22;
}
}
bl = true;
}
if (httpConnection != null) {
httpConnection.close();
httpConnection = null;
}
if (bl) {
long l3 = -1;
long l4 = -1;
boolean bl3 = true;
do {
if (!bl3) {
try {
Thread.sleep(2500L);
}
catch (Exception exception) {}
}
try {
XElem xElem = XParser.make((InputStream)this.getDaemonSession().getInputStream(new GetDirectoryMessage(new FilePath("/niagara/niagaraR2/rel/stations/" + this.getAppName()), false, true, false, bR2StationSurrogate.getDaemonSession().getFileSpace()))).parse();
XElem[] xElemArray = xElem.elems("file");
XElem xElem3 = null;
int n = 0;
while (n < xElemArray.length) {
if (xElemArray[n].get("name").equalsIgnoreCase("config.sns")) {
xElem3 = xElemArray[n];
break;
}
++n;
}
if (xElem3 == null) continue;
BDaemonFileStore bDaemonFileStore = new BDaemonFileStore(bR2StationSurrogate.getDaemonSession().getFileSpace(), new FilePath("/niagara/niagaraR2/rel/stations/" + this.getAppName() + "/config.sns"), xElem3);
l3 = bDaemonFileStore.getCrc();
l4 = bDaemonFileStore.getLastModified().getMillis();
}
catch (Exception exception) {
break;
}
} while (l2 == l3 && l == l4);
}
}
public static void stopR2Station(BDaemonSession bDaemonSession, String string, ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) throws ConnectException, AuthenticationException {
try {
BR2StationSurrogate.make(bDaemonSession, string).stopApp(iCancelHint, daemonSessionTaskListener);
}
catch (ConnectException connectException) {
throw connectException;
}
catch (AuthenticationException authenticationException) {
throw authenticationException;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public static void stopR2StationAsync(BDaemonSession bDaemonSession, String string) throws ConnectException, AuthenticationException {
try {
BR2StationSurrogate.make(bDaemonSession, string).stopAppAsync();
}
catch (ConnectException connectException) {
throw connectException;
}
catch (AuthenticationException authenticationException) {
throw authenticationException;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public void stopR2StationAsync() throws ConnectException, AuthenticationException {
this.stopAppAsync();
}
public void stopR2Station(ICancelHint iCancelHint) throws ConnectException, AuthenticationException {
this.stopApp(iCancelHint);
}
public void stopR2Station(ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) throws ConnectException, AuthenticationException {
this.stopApp(iCancelHint, daemonSessionTaskListener);
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public void stopApp(ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) throws ConnectException, AuthenticationException {
if (!this.isAppStopped()) {
CancelableDaemonSessionTask cancelableDaemonSessionTask = null;
try {
block16: {
try {
if (this.getAppStatus() == BStationStatus.stopping) break block16;
if (daemonSessionTaskListener != null) {
cancelableDaemonSessionTask = new CancelableDaemonSessionTask(lex, "R2StationSurrogate.stopping.title", "R2StationSurrogate.stopping.message", new Object[]{this.getAppName()}, iCancelHint);
cancelableDaemonSessionTask.setCancelLabel(lex.getText("AppSurrogate.stopping.cancel"));
daemonSessionTaskListener.taskStarted(cancelableDaemonSessionTask);
}
this.stopAppAsync();
this.poll();
while (true) {
if (this.isAppStopped() || BR2StationSurrogate.isCanceled(cancelableDaemonSessionTask)) {
if (!this.isAppStopped() && !BR2StationSurrogate.isCanceled(cancelableDaemonSessionTask)) {
throw new BajaRuntimeException("R2Station stop failed");
}
break;
}
Thread.sleep(1000L);
this.poll();
}
}
catch (ConnectException connectException) {
throw connectException;
}
catch (AuthenticationException authenticationException) {
throw authenticationException;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
Object var5_10 = null;
if (daemonSessionTaskListener != null && cancelableDaemonSessionTask != null) {
daemonSessionTaskListener.taskFinished(cancelableDaemonSessionTask);
}
}
catch (Throwable throwable) {
Object var5_9 = null;
if (daemonSessionTaskListener != null && cancelableDaemonSessionTask != null) {
daemonSessionTaskListener.taskFinished(cancelableDaemonSessionTask);
}
throw throwable;
}
if (BR2StationSurrogate.isCanceled(cancelableDaemonSessionTask)) {
throw new ICancelHint.CanceledException();
}
}
}
public void restartR2StationAsync() throws ConnectException, AuthenticationException {
this.restartAppAsync();
}
public void restartR2StationAsync(boolean bl) throws ConnectException, AuthenticationException {
this.restartAppAsync(bl);
}
public void killR2StationAsync() throws ConnectException, AuthenticationException {
this.killAppAsync();
}
public void killR2Station(ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) throws ConnectException, AuthenticationException {
this.killApp(iCancelHint, daemonSessionTaskListener);
}
public void makeR2StationCopy(BDirectory bDirectory, DaemonSessionTaskListener daemonSessionTaskListener) throws Exception {
BDaemonDirectoryStore bDaemonDirectoryStore = BDaemonDirectoryStore.make(this.getDaemonSession().getFileSpace(), new FilePath("!niagaraR2/rel/stations/" + this.getAppName()), true, false, false, new StoreCache());
bDaemonDirectoryStore.copyToLocalHost(bDirectory.getFilePath(), daemonSessionTaskListener);
}
public void deleteR2Station(ICancelHint iCancelHint) throws ConnectException, AuthenticationException {
this.deleteApp(iCancelHint, null);
}
public void deleteR2Station(ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) throws ConnectException, AuthenticationException {
this.deleteApp(iCancelHint, daemonSessionTaskListener);
}
public void deleteApp(ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) throws ConnectException, AuthenticationException {
super.deleteApp(iCancelHint, daemonSessionTaskListener);
DaemonFileUtil.transfer(this.getDaemonSession(), FileTransferMessage.makeDelete(new FilePath("!niagaraR2/rel/stations/" + this.getAppName()), this.getDaemonSession().getFileSpace()), iCancelHint, daemonSessionTaskListener);
}
private final String readFully(HttpConnection httpConnection) {
try {
int n;
byte[] byArray = new byte[1024];
BufferedInputStream bufferedInputStream = new BufferedInputStream(httpConnection.getInputStream());
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
while ((n = bufferedInputStream.read(byArray, 0, 1024)) > 0) {
byteArrayOutputStream.write(byArray, 0, n);
}
return byteArrayOutputStream.toString();
}
catch (Exception exception) {
return 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());
}
}
public BR2StationSurrogate() {
throw new UnsupportedOperationException();
}
public BR2StationSurrogate(BDaemonSession bDaemonSession) {
super(bDaemonSession);
}
static {
Class clazz = class$com$tridium$platform$daemon$BR2StationSurrogate;
if (clazz == null) {
clazz = class$com$tridium$platform$daemon$BR2StationSurrogate = BR2StationSurrogate.class("[Lcom.tridium.platform.daemon.BR2StationSurrogate;", false);
}
TYPE = Sys.loadType((Class)clazz);
connectedIcon = BIcon.std((String)"r2/station.png");
disconnectedIcon = BIcon.std((String)"r2/stationDisconnected.png");
}
private static class ThreadDumpMessage
extends XmlResponseMessage {
private StringBuffer path = new StringBuffer("r2station");
public String getMessageString() {
return this.path.toString();
}
public ThreadDumpMessage(String string) {
this.path.append("?action=threads&r2station=").append(HttpUtil.encodeUrl((String)string));
}
}
}
@@ -0,0 +1,235 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.net.HttpUtil
* javax.baja.naming.BOrd
* javax.baja.security.AuthenticationException
* javax.baja.sys.BIcon
* javax.baja.sys.BValue
* javax.baja.sys.BajaRuntimeException
* javax.baja.sys.Property
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.xml.XElem
*/
package com.tridium.platform.daemon;
import com.tridium.net.HttpUtil;
import com.tridium.platform.daemon.BAppSurrogate;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.message.XmlResponseMessage;
import com.tridium.platform.daemon.task.DaemonSessionTaskListener;
import java.net.ConnectException;
import java.util.Iterator;
import java.util.Map;
import javax.baja.naming.BOrd;
import javax.baja.platform.ICancelHint;
import javax.baja.security.AuthenticationException;
import javax.baja.sys.BIcon;
import javax.baja.sys.BValue;
import javax.baja.sys.BajaRuntimeException;
import javax.baja.sys.Property;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.xml.XElem;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BSedonaSurrogate
extends BAppSurrogate {
public static final Property soxPort = BSedonaSurrogate.newProperty((int)3, (int)-1, null);
public static final Property httpPort = BSedonaSurrogate.newProperty((int)3, (int)-1, null);
public static final Property soxOrd = BSedonaSurrogate.newProperty((int)3, (BValue)BOrd.DEFAULT, null);
public static final Type TYPE;
protected static final BIcon connectedIcon;
protected static final BIcon disconnectedIcon;
static /* synthetic */ Class class$com$tridium$platform$daemon$BSedonaSurrogate;
public int getSoxPort() {
return this.getInt(soxPort);
}
public void setSoxPort(int n) {
this.setInt(soxPort, n, null);
}
public int getHttpPort() {
return this.getInt(httpPort);
}
public void setHttpPort(int n) {
this.setInt(httpPort, n, null);
}
public BOrd getSoxOrd() {
return (BOrd)this.get(soxOrd);
}
public void setSoxOrd(BOrd bOrd) {
this.set(soxOrd, (BValue)bOrd, null);
}
public Type getType() {
return TYPE;
}
public static BSedonaSurrogate make(BDaemonSession bDaemonSession, String string) throws Exception {
BSedonaSurrogate bSedonaSurrogate = new BSedonaSurrogate(bDaemonSession);
bSedonaSurrogate.setAppName(string);
bSedonaSurrogate.poll();
return bSedonaSurrogate;
}
public static BSedonaSurrogate[] makeAll(BDaemonSession bDaemonSession) throws Exception {
Map map = BSedonaSurrogate.getAppElementMap(TYPE, bDaemonSession);
BSedonaSurrogate[] bSedonaSurrogateArray = new BSedonaSurrogate[map.size()];
int n = 0;
Iterator iterator = map.values().iterator();
while (iterator.hasNext()) {
bSedonaSurrogateArray[n] = new BSedonaSurrogate(bDaemonSession);
bSedonaSurrogateArray[n].updateFields((XElem)iterator.next());
++n;
}
return bSedonaSurrogateArray;
}
public static boolean isAnySedonaAppRunning(BDaemonSession bDaemonSession) throws Exception {
return BSedonaSurrogate.isAnyAppRunning(TYPE, bDaemonSession);
}
public static BSedonaSurrogate[] stopAllSedonaApps(BDaemonSession bDaemonSession, ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) throws Exception {
BAppSurrogate[] bAppSurrogateArray = BSedonaSurrogate.stopAllApps(bDaemonSession, TYPE, iCancelHint, daemonSessionTaskListener);
BSedonaSurrogate[] bSedonaSurrogateArray = new BSedonaSurrogate[bAppSurrogateArray.length];
System.arraycopy(bAppSurrogateArray, 0, bSedonaSurrogateArray, 0, bAppSurrogateArray.length);
return bSedonaSurrogateArray;
}
public static BSedonaSurrogate[] stopAllSedonaApps(BDaemonSession bDaemonSession, BSedonaSurrogate[] bSedonaSurrogateArray, ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) throws Exception {
BAppSurrogate[] bAppSurrogateArray = BSedonaSurrogate.stopAllApps(bDaemonSession, TYPE, bSedonaSurrogateArray, iCancelHint, daemonSessionTaskListener);
BSedonaSurrogate[] bSedonaSurrogateArray2 = new BSedonaSurrogate[bAppSurrogateArray.length];
System.arraycopy(bAppSurrogateArray, 0, bSedonaSurrogateArray2, 0, bAppSurrogateArray.length);
return bSedonaSurrogateArray2;
}
public static void stopApp(BDaemonSession bDaemonSession, String string, ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) throws ConnectException, AuthenticationException {
try {
BSedonaSurrogate.make(bDaemonSession, string).stopApp(iCancelHint, daemonSessionTaskListener);
}
catch (ConnectException connectException) {
throw connectException;
}
catch (AuthenticationException authenticationException) {
throw authenticationException;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public void updateFields(XElem xElem) {
super.updateFields(xElem);
XElem xElem2 = xElem.elem("sox");
if (xElem2 != null) {
this.setSoxPort(xElem2.geti("value"));
this.setSoxOrd(BOrd.make((BOrd)this.session.getHost().getNavOrd(), (String)("sox:" + xElem2.get("value"))));
}
if ((xElem2 = xElem.elem("web")) != null) {
this.setHttpPort(xElem2.geti("value"));
}
}
public void deleteApp(ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) throws ConnectException, AuthenticationException {
super.deleteApp(iCancelHint, daemonSessionTaskListener);
}
public static void saveSedonaAppAsync(BDaemonSession bDaemonSession, String string) throws ConnectException, AuthenticationException {
try {
BSedonaSurrogate.make(bDaemonSession, string).saveSedonaAppAsync();
}
catch (ConnectException connectException) {
throw connectException;
}
catch (AuthenticationException authenticationException) {
throw authenticationException;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public void saveSedonaAppAsync() throws ConnectException, AuthenticationException {
try {
this.getDaemonSession().sendMessage(new SaveSedonaAppMessage(this.getAppName()));
}
catch (ConnectException connectException) {
throw connectException;
}
catch (AuthenticationException authenticationException) {
throw authenticationException;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public BIcon getIcon() {
return this.isAppRunning() ? connectedIcon : disconnectedIcon;
}
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 BSedonaSurrogate() {
throw new UnsupportedOperationException();
}
public BSedonaSurrogate(BDaemonSession bDaemonSession) {
super(bDaemonSession);
}
static {
Class clazz = class$com$tridium$platform$daemon$BSedonaSurrogate;
if (clazz == null) {
clazz = class$com$tridium$platform$daemon$BSedonaSurrogate = BSedonaSurrogate.class("[Lcom.tridium.platform.daemon.BSedonaSurrogate;", false);
}
TYPE = Sys.loadType((Class)clazz);
connectedIcon = BIcon.std((String)"sox.png");
disconnectedIcon = BIcon.std((String)"soxDisconnected.png");
}
private static class SaveSedonaAppMessage
extends XmlResponseMessage {
private StringBuffer path = new StringBuffer("sedona?action=tell&");
public String getMessageString() {
return this.path.toString();
}
public SaveSedonaAppMessage(String string) {
this.path.append("sedona=").append(HttpUtil.encodeUrl((String)string));
this.path.append("&message=save");
}
}
}
@@ -0,0 +1,675 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.fox.sys.BFoxScheme
* com.tridium.fox.sys.BFoxsScheme
* com.tridium.net.HttpUtil
* javax.baja.file.BDirectory
* javax.baja.file.FilePath
* javax.baja.job.BJobState
* javax.baja.naming.BOrd
* javax.baja.naming.OrdQuery
* javax.baja.security.AuthenticationException
* javax.baja.sys.BValue
* javax.baja.sys.BajaRuntimeException
* javax.baja.sys.Clock
* javax.baja.sys.Property
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.xml.XElem
* javax.baja.xml.XParser
*/
package com.tridium.platform.daemon;
import com.tridium.fox.sys.BFoxScheme;
import com.tridium.fox.sys.BFoxsScheme;
import com.tridium.net.HttpUtil;
import com.tridium.platform.daemon.BAppSurrogate;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.DaemonFileUtil;
import com.tridium.platform.daemon.file.BDaemonDirectoryStore;
import com.tridium.platform.daemon.file.StoreCache;
import com.tridium.platform.daemon.message.FileTransferMessage;
import com.tridium.platform.daemon.message.XmlResponseMessage;
import com.tridium.platform.daemon.task.CancelableDaemonSessionTask;
import com.tridium.platform.daemon.task.DaemonSessionTaskListener;
import java.io.InputStream;
import java.net.ConnectException;
import javax.baja.file.BDirectory;
import javax.baja.file.FilePath;
import javax.baja.job.BJobState;
import javax.baja.naming.BOrd;
import javax.baja.naming.OrdQuery;
import javax.baja.platform.BStationStatus;
import javax.baja.platform.ICancelHint;
import javax.baja.security.AuthenticationException;
import javax.baja.sys.BValue;
import javax.baja.sys.BajaRuntimeException;
import javax.baja.sys.Clock;
import javax.baja.sys.Property;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.xml.XElem;
import javax.baja.xml.XParser;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BStationSurrogate
extends BAppSurrogate {
public static final Property foxPort = BStationSurrogate.newProperty((int)3, (int)-1, null);
public static final Property foxsPort = BStationSurrogate.newProperty((int)3, (int)-1, null);
public static final Property httpPort = BStationSurrogate.newProperty((int)3, (int)-1, null);
public static final Property httpsPort = BStationSurrogate.newProperty((int)3, (int)-1, null);
public static final Property foxOrd = BStationSurrogate.newProperty((int)3, (BValue)BOrd.DEFAULT, null);
public static final Property foxsOrd = BStationSurrogate.newProperty((int)3, (BValue)BOrd.DEFAULT, null);
public static final Type TYPE;
static /* synthetic */ Class class$com$tridium$platform$daemon$BStationSurrogate;
public String getStationName() {
return this.getAppName();
}
public void setStationName(String string) {
this.setAppName(string);
}
public BStationStatus getStationStatus() {
return this.getAppStatus();
}
public void setStationStatus(BStationStatus bStationStatus) {
this.setAppStatus(bStationStatus);
}
public int getFoxPort() {
return this.getInt(foxPort);
}
public void setFoxPort(int n) {
this.setInt(foxPort, n, null);
}
public int getFoxsPort() {
return this.getInt(foxsPort);
}
public void setFoxsPort(int n) {
this.setInt(foxsPort, n, null);
}
public int getHttpPort() {
return this.getInt(httpPort);
}
public void setHttpPort(int n) {
this.setInt(httpPort, n, null);
}
public int getHttpsPort() {
return this.getInt(httpsPort);
}
public void setHttpsPort(int n) {
this.setInt(httpsPort, n, null);
}
public BOrd getFoxOrd() {
return (BOrd)this.get(foxOrd);
}
public void setFoxOrd(BOrd bOrd) {
this.set(foxOrd, (BValue)bOrd, null);
}
public BOrd getFoxsOrd() {
return (BOrd)this.get(foxsOrd);
}
public void setFoxsOrd(BOrd bOrd) {
this.set(foxsOrd, (BValue)bOrd, null);
}
public Type getType() {
return TYPE;
}
public static BStationSurrogate make(BDaemonSession bDaemonSession, String string) throws Exception {
BStationSurrogate bStationSurrogate = new BStationSurrogate(bDaemonSession);
bStationSurrogate.setAppName(string);
bStationSurrogate.poll();
return bStationSurrogate;
}
public static BStationSurrogate[] makeAll(BDaemonSession bDaemonSession) throws Exception {
return (BStationSurrogate[])BStationSurrogate.makeAll(TYPE, bDaemonSession);
}
public static boolean isAnyStationRunning(BDaemonSession bDaemonSession) throws Exception {
return BStationSurrogate.isAnyAppRunning(TYPE, bDaemonSession);
}
public void updateFields(XElem xElem) {
int n;
StringBuffer stringBuffer;
super.updateFields(xElem);
XElem xElem2 = xElem.elem("foxport");
if (xElem2 != null) {
this.setFoxPort(xElem2.geti("value"));
if (this.getFoxPort() == -1) {
this.setFoxOrd(BOrd.DEFAULT);
} else if (this.session.getTunnelAuthorities() == null) {
this.setFoxOrd(BOrd.make((BOrd)this.session.getHost().getNavOrd(), (OrdQuery)BFoxScheme.INSTANCE.parse(xElem2.get("value"))));
} else {
stringBuffer = new StringBuffer();
n = 0;
while (n < this.session.getTunnelAuthorities().length) {
stringBuffer.append('/').append(this.session.getTunnelAuthorities()[n]);
++n;
}
stringBuffer.append(':').append(xElem2.get("value"));
this.setFoxOrd(BOrd.make((BOrd)this.session.getHost().getNavOrd(), (OrdQuery)BFoxScheme.INSTANCE.parse(stringBuffer.toString())));
}
} else {
this.setFoxPort(-1);
this.setFoxOrd(BOrd.DEFAULT);
}
xElem2 = xElem.elem("foxsport");
if (xElem2 != null) {
this.setFoxsPort(xElem2.geti("value"));
if (this.getFoxsPort() == -1) {
this.setFoxsOrd(BOrd.DEFAULT);
} else if (this.session.getTunnelAuthorities() == null) {
this.setFoxsOrd(BOrd.make((BOrd)this.session.getHost().getNavOrd(), (OrdQuery)BFoxsScheme.INSTANCE.parse(xElem2.get("value"))));
} else {
stringBuffer = new StringBuffer();
n = 0;
while (n < this.session.getTunnelAuthorities().length) {
stringBuffer.append('/').append(this.session.getTunnelAuthorities()[n]);
++n;
}
stringBuffer.append(':').append(xElem2.get("value"));
this.setFoxsOrd(BOrd.make((BOrd)this.session.getHost().getNavOrd(), (OrdQuery)BFoxsScheme.INSTANCE.parse(stringBuffer.toString())));
}
} else {
this.setFoxsPort(-1);
this.setFoxsOrd(BOrd.DEFAULT);
}
xElem2 = xElem.elem("httpport");
if (xElem2 != null) {
this.setHttpPort(xElem2.geti("value"));
} else {
this.setHttpPort(-1);
}
xElem2 = xElem.elem("httpsport");
if (xElem2 != null) {
this.setHttpsPort(xElem2.geti("value"));
} else {
this.setHttpsPort(-1);
}
}
public InputStream getStationOutput() throws ConnectException, AuthenticationException {
return this.getAppOutput(true, false);
}
public InputStream getStationOutput(boolean bl) throws ConnectException, AuthenticationException {
return this.getAppOutput(bl, false);
}
public InputStream getStationOutput(boolean bl, boolean bl2) throws ConnectException, AuthenticationException {
return this.getAppOutput(bl, bl2);
}
public void dumpThreads() throws ConnectException, AuthenticationException {
this.getDaemonSession().sendMessage(new ThreadDumpMessage(this.getAppName()));
}
public void startStationAsync() throws ConnectException, AuthenticationException {
this.startAppAsync();
}
public void startStation(ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) throws Exception {
this.startApp(iCancelHint, daemonSessionTaskListener);
}
public static BStationSurrogate[] stopAllStations(BDaemonSession bDaemonSession, ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) throws Exception {
return (BStationSurrogate[])BStationSurrogate.stopAllApps(bDaemonSession, TYPE, BStationSurrogate.makeAll(bDaemonSession), iCancelHint, daemonSessionTaskListener);
}
public static BStationSurrogate[] stopAllStations(BDaemonSession bDaemonSession, BStationSurrogate[] bStationSurrogateArray, ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) throws Exception {
return (BStationSurrogate[])BStationSurrogate.stopAllApps(bDaemonSession, TYPE, bStationSurrogateArray, iCancelHint, daemonSessionTaskListener);
}
public static void saveStation(BDaemonSession bDaemonSession, String string, ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) throws ConnectException, AuthenticationException {
try {
BStationSurrogate.make(bDaemonSession, string).saveStation(iCancelHint, daemonSessionTaskListener);
}
catch (ConnectException connectException) {
throw connectException;
}
catch (AuthenticationException authenticationException) {
throw authenticationException;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public static void saveStationAsync(BDaemonSession bDaemonSession, String string) throws ConnectException, AuthenticationException {
try {
BStationSurrogate.make(bDaemonSession, string).saveStationAsync();
}
catch (ConnectException connectException) {
throw connectException;
}
catch (AuthenticationException authenticationException) {
throw authenticationException;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public void syncStationModulesAsync() throws ConnectException, AuthenticationException {
try {
this.getDaemonSession().sendMessage(new SyncStationModulesMessage(this.getStationName()));
}
catch (ConnectException connectException) {
throw connectException;
}
catch (AuthenticationException authenticationException) {
throw authenticationException;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public void saveStationAsync() throws ConnectException, AuthenticationException {
try {
this.getDaemonSession().sendMessage(new SaveStationMessage(this.getStationName()));
}
catch (ConnectException connectException) {
throw connectException;
}
catch (AuthenticationException authenticationException) {
throw authenticationException;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public void saveStation(ICancelHint iCancelHint) throws ConnectException, AuthenticationException {
this.saveStation(iCancelHint, null);
}
/*
* 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 saveStation(ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) throws ConnectException, AuthenticationException {
CancelableDaemonSessionTask cancelableDaemonSessionTask;
block14: {
if (this.getAppStatus() != BStationStatus.running) {
return;
}
cancelableDaemonSessionTask = null;
try {
try {
if (daemonSessionTaskListener != null) {
cancelableDaemonSessionTask = new CancelableDaemonSessionTask(lex, "StationSurrogate.saving.title", "StationSurrogate.saving.message", new Object[]{this.getAppName()}, iCancelHint);
cancelableDaemonSessionTask.setCancelLabel(lex.getText("StationSurrogate.saving.cancel"));
daemonSessionTaskListener.taskStarted(cancelableDaemonSessionTask);
}
JobResult jobResult = this.getJobResult(this.getAppName());
log.trace("saveStation initial jobResult = " + jobResult);
long l = jobResult == null ? 0L : jobResult.millis;
this.saveStationAsync();
jobResult = this.getJobResult(this.getAppName());
while (true) {
block15: {
if (!BStationSurrogate.newCompletedJob(jobResult, l) && !BStationSurrogate.isCanceled(cancelableDaemonSessionTask)) break block15;
if (jobResult != null && jobResult.state != BJobState.success && !BStationSurrogate.isCanceled(cancelableDaemonSessionTask)) {
throw new BajaRuntimeException("Station save failed: " + jobResult.state);
}
break;
}
Thread.sleep(1000L);
jobResult = this.getJobResult(this.getAppName());
log.trace("saveStation jobResult = " + jobResult);
}
}
catch (ConnectException connectException) {
throw connectException;
}
catch (AuthenticationException authenticationException) {
throw authenticationException;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
catch (Throwable throwable) {
Object var5_11 = null;
if (daemonSessionTaskListener != null && cancelableDaemonSessionTask != null) {
daemonSessionTaskListener.taskFinished(cancelableDaemonSessionTask);
}
throw throwable;
}
{
Object var5_12 = null;
if (daemonSessionTaskListener == null || cancelableDaemonSessionTask == null) break block14;
daemonSessionTaskListener.taskFinished(cancelableDaemonSessionTask);
}
}
if (BStationSurrogate.isCanceled(cancelableDaemonSessionTask)) {
throw new ICancelHint.CanceledException();
}
}
public static void stopStation(BDaemonSession bDaemonSession, String string, ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) throws ConnectException, AuthenticationException {
try {
BStationSurrogate.make(bDaemonSession, string).stopApp(iCancelHint, daemonSessionTaskListener);
}
catch (ConnectException connectException) {
throw connectException;
}
catch (AuthenticationException authenticationException) {
throw authenticationException;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public static void stopStationAsync(BDaemonSession bDaemonSession, String string) throws ConnectException, AuthenticationException {
try {
BStationSurrogate.make(bDaemonSession, string).stopAppAsync();
}
catch (ConnectException connectException) {
throw connectException;
}
catch (AuthenticationException authenticationException) {
throw authenticationException;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public void stopStationAsync() throws ConnectException, AuthenticationException {
this.stopAppAsync();
}
public void stopStation(ICancelHint iCancelHint) throws ConnectException, AuthenticationException {
this.stopApp(iCancelHint);
}
public void stopStation(ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) throws ConnectException, AuthenticationException {
this.stopApp(iCancelHint, daemonSessionTaskListener);
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public void stopApp(ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) throws ConnectException, AuthenticationException {
if (!this.isAppStopped()) {
CancelableDaemonSessionTask cancelableDaemonSessionTask = null;
try {
block16: {
try {
if (this.getAppStatus() == BStationStatus.stopping) break block16;
if (daemonSessionTaskListener != null) {
cancelableDaemonSessionTask = new CancelableDaemonSessionTask(lex, "StationSurrogate.stopping.title", "StationSurrogate.stopping.message", new Object[]{this.getAppName()}, iCancelHint);
cancelableDaemonSessionTask.setCancelLabel(lex.getText("AppSurrogate.stopping.cancel"));
daemonSessionTaskListener.taskStarted(cancelableDaemonSessionTask);
}
JobResult jobResult = this.getJobResult(this.getAppName());
log.trace("stopStation initial jobResult = " + jobResult);
long l = jobResult == null ? 0L : jobResult.millis;
this.stopAppAsync();
jobResult = this.getJobResult(this.getAppName());
this.poll();
while (true) {
if (this.isAppStopped() || BStationSurrogate.newCompletedJob(jobResult, l) || BStationSurrogate.isCanceled(cancelableDaemonSessionTask)) {
if (!this.isAppStopped() && jobResult != null && jobResult.state != BJobState.success && !BStationSurrogate.isCanceled(cancelableDaemonSessionTask)) {
throw new BajaRuntimeException("Station save failed: " + jobResult.state);
}
break;
}
Thread.sleep(1000L);
this.poll();
jobResult = this.getJobResult(this.getAppName());
log.trace("stopStation jobResult = " + jobResult);
}
}
catch (ConnectException connectException) {
throw connectException;
}
catch (AuthenticationException authenticationException) {
throw authenticationException;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
Object var5_12 = null;
if (daemonSessionTaskListener != null && cancelableDaemonSessionTask != null) {
daemonSessionTaskListener.taskFinished(cancelableDaemonSessionTask);
}
}
catch (Throwable throwable) {
Object var5_11 = null;
if (daemonSessionTaskListener != null && cancelableDaemonSessionTask != null) {
daemonSessionTaskListener.taskFinished(cancelableDaemonSessionTask);
}
throw throwable;
}
if (BStationSurrogate.isCanceled(cancelableDaemonSessionTask)) {
throw new ICancelHint.CanceledException();
}
}
}
public void restartStationAsync() throws ConnectException, AuthenticationException {
this.restartAppAsync();
}
public void restartStationAsync(boolean bl) throws ConnectException, AuthenticationException {
this.restartAppAsync(bl);
}
public void deleteStation(ICancelHint iCancelHint) throws ConnectException, AuthenticationException {
this.deleteApp(iCancelHint, null);
}
public void deleteStation(ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) throws ConnectException, AuthenticationException {
this.deleteApp(iCancelHint, daemonSessionTaskListener);
}
public void deleteApp(ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) throws ConnectException, AuthenticationException {
super.deleteApp(iCancelHint, daemonSessionTaskListener);
DaemonFileUtil.transfer(this.getDaemonSession(), FileTransferMessage.makeDelete(new FilePath("!stations/" + this.getAppName()), this.getDaemonSession().getFileSpace()), iCancelHint, daemonSessionTaskListener);
}
public void killStationAsync() throws ConnectException, AuthenticationException {
this.killAppAsync();
}
public void killStation(ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) throws ConnectException, AuthenticationException {
this.killApp(iCancelHint, daemonSessionTaskListener);
}
public void makeStationCopy(BDirectory bDirectory, DaemonSessionTaskListener daemonSessionTaskListener) throws Exception {
BDaemonDirectoryStore bDaemonDirectoryStore = BDaemonDirectoryStore.make(this.getDaemonSession().getFileSpace(), new FilePath("!stations/" + this.getAppName()), true, false, false, new StoreCache());
bDaemonDirectoryStore.copyToLocalHost(bDirectory.getFilePath(), daemonSessionTaskListener);
}
public boolean isStationRunning() {
return this.isAppRunning();
}
public boolean isStationStopped() {
return this.isAppStopped();
}
public static boolean newCompletedJob(JobResult jobResult, long l) {
if (jobResult == null) {
return false;
}
if (jobResult.state.isComplete()) {
boolean bl = false;
if (jobResult.millis > l) {
bl = true;
}
return bl;
}
return false;
}
private final JobResult getJobResult(String string) throws Exception {
XElem xElem = XParser.make((InputStream)this.session.getInputStream(new QueryRequestStateMessage("baja:StationSaveJob@" + string))).parse();
if (xElem.name().equals("request") && xElem.get("state", null) != null) {
return new JobResult(xElem.get("state", null));
}
log.trace("getJobResult returns null for station " + this.getAppName());
return 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());
}
}
public BStationSurrogate() {
throw new UnsupportedOperationException();
}
public BStationSurrogate(BDaemonSession bDaemonSession) {
super(bDaemonSession);
}
static {
Class clazz = class$com$tridium$platform$daemon$BStationSurrogate;
if (clazz == null) {
clazz = class$com$tridium$platform$daemon$BStationSurrogate = BStationSurrogate.class("[Lcom.tridium.platform.daemon.BStationSurrogate;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
private static class ThreadDumpMessage
extends XmlResponseMessage {
private StringBuffer path = new StringBuffer("station");
public String getMessageString() {
return this.path.toString();
}
public ThreadDumpMessage(String string) {
this.path.append("?action=threads&station=").append(HttpUtil.encodeUrl((String)string));
}
}
private static class SyncStationModulesMessage
extends XmlResponseMessage {
private StringBuffer path = new StringBuffer("station?action=tell&");
public String getMessageString() {
return this.path.toString();
}
public SyncStationModulesMessage(String string) {
this.path.append("station=").append(HttpUtil.encodeUrl((String)string));
this.path.append("&message=syncmodules");
}
}
private static class SaveStationMessage
extends XmlResponseMessage {
private StringBuffer path = new StringBuffer("station?action=tell&");
public String getMessageString() {
return this.path.toString();
}
public SaveStationMessage(String string) {
this.path.append("station=").append(HttpUtil.encodeUrl((String)string));
this.path.append("&message=save");
this.path.append(HttpUtil.encodeUrl((String)(" baja:StationSaveJob@" + string)));
}
}
private static class JobResult {
public BJobState state;
public long millis;
public String toString() {
return "JobResult(" + this.state.toString() + ',' + this.millis + ')';
}
public JobResult(String string) {
log.trace("JobResult parse=" + string);
int n = string.indexOf(64);
if (n < 0) {
this.state = BJobState.make((String)string);
this.millis = this.state == BJobState.unknown ? 0L : Clock.millis();
} else {
this.state = BJobState.make((String)string.substring(0, n));
this.millis = Long.parseLong(string.substring(n + 1));
}
}
}
private static class QueryRequestStateMessage
extends XmlResponseMessage {
private StringBuffer path = new StringBuffer("requeststate");
public String getMessageString() {
return this.path.toString();
}
public QueryRequestStateMessage(String string) {
this.path.append("?requestid=").append(HttpUtil.encodeUrl((String)string));
}
}
}
@@ -0,0 +1,47 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.net.HttpConnection
* javax.baja.nre.util.Base64
*/
package com.tridium.platform.daemon;
import com.tridium.platform.daemon.Authenticator;
import java.io.IOException;
import java.util.Properties;
import javax.baja.net.HttpConnection;
import javax.baja.nre.util.Base64;
public class BasicAuthenticator
extends Authenticator {
private String realm;
public String getAuthenticationScheme() {
return "HTTP-Basic";
}
public boolean setAuthorization(HttpConnection httpConnection, String string) throws IOException {
return this.setAuthorization(httpConnection, string, null);
}
public boolean setAuthorization(HttpConnection httpConnection, String string, Properties properties) throws IOException {
if (this.getUserAndPwd() == null) {
return false;
}
StringBuffer stringBuffer = new StringBuffer();
String string2 = this.getUserAndPwd().getUsername() + ':' + this.getUserAndPwd().getPassword().getValue();
stringBuffer.append("Basic ").append(Base64.encode((byte[])string2.getBytes()));
httpConnection.setRequestHeader("Authorization", stringBuffer.toString());
return true;
}
public String getAuthenticationRealmName() {
return this.realm;
}
protected BasicAuthenticator(String string) {
this.realm = string;
}
}
@@ -0,0 +1,167 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.log.Log
*/
package com.tridium.platform.daemon;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
import javax.baja.log.Log;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class ConsoleInputStream
extends InputStream {
public static Log log = Log.getLog((String)"platform.console");
private InputStream in;
private byte[] buf;
private int bufSize;
private int pendingRead;
private int nextRead;
public static ConsoleInputStream make(InputStream inputStream) {
return inputStream == null ? null : new ConsoleInputStream(inputStream);
}
public void close() throws IOException {
this.in.close();
this.in = null;
}
public long skip(long l) throws IOException {
if (this.in == null) {
throw new IOException("skip() on closed stream");
}
if (!this.checkBuffer()) {
return 0L;
}
long l2 = this.bufSize - this.nextRead;
long l3 = l <= l2 ? l : l2;
this.nextRead = (int)((long)this.nextRead + l3);
return l3;
}
public int read(byte[] byArray) throws IOException {
return this.read(byArray, 0, byArray.length);
}
public int read(byte[] byArray, int n, int n2) throws IOException {
int n3;
if (this.in == null) {
throw new IOException("read() on closed stream");
}
if (!this.checkBuffer()) {
this.throwEOFException("error in checkBuffer");
}
int n4 = n2 <= (n3 = this.bufSize - this.nextRead) ? n2 : n3;
System.arraycopy(this.buf, this.nextRead, byArray, n, n4);
this.nextRead += n4;
return n4;
}
public int read() throws IOException {
if (this.in == null) {
throw new IOException("read() on closed stream");
}
if (!this.checkBuffer()) {
return -1;
}
int n = this.buf[this.nextRead] & 0xFF;
++this.nextRead;
return n;
}
private final void throwEOFException(String string) throws EOFException {
EOFException eOFException = new EOFException();
log.trace(string, (Throwable)eOFException);
throw eOFException;
}
/*
* Unable to fully structure code
*/
private final boolean checkBuffer() throws IOException {
if (this.in != null) ** GOTO lbl43
throw new IOException("checkBuffer() on closed stream");
lbl-1000:
// 1 sources
{
if (this.pendingRead == 0) {
var1_1 = this.in.read();
if (var1_1 == -1) {
this.throwEOFException("invalid buflength byte 0");
}
this.pendingRead = var1_1 << 24;
try {
var1_1 = this.in.read();
if (var1_1 == -1) {
this.throwEOFException("invalid buflength byte 1");
}
this.pendingRead += var1_1 << 16;
var1_1 = this.in.read();
if (var1_1 == -1) {
this.throwEOFException("invalid buflength byte 2");
}
this.pendingRead += var1_1 << 8;
var1_1 = this.in.read();
if (var1_1 == -1) {
this.throwEOFException("invalid buflength byte 3");
}
this.pendingRead += var1_1;
}
catch (InterruptedIOException var2_2) {
this.pendingRead = 0;
throw new IOException("Timeout while reading buffer size");
}
}
if (this.pendingRead > 1024) {
this.bufSize = 0;
this.nextRead = 0;
this.pendingRead = 0;
throw new IOException("Improper buffer size (" + this.bufSize + "), stream probably corrupt");
}
if (this.pendingRead > 0) {
this.bufSize = this.in.read(this.buf, 0, this.pendingRead);
if (this.bufSize < 0) {
this.bufSize = 0;
this.nextRead = 0;
return false;
}
this.pendingRead -= this.bufSize;
this.nextRead = 0;
return true;
}
if (this.pendingRead >= 0) continue;
this.bufSize = 0;
this.nextRead = 0;
throw new IOException("Improper buffer size, stream probably corrupt");
lbl43:
// 2 sources
** while (this.nextRead >= this.bufSize)
}
lbl44:
// 1 sources
return true;
}
private final /* synthetic */ void this() {
this.buf = new byte[1024];
this.bufSize = 0;
this.pendingRead = 0;
this.nextRead = 0;
}
private ConsoleInputStream(InputStream inputStream) {
this.this();
this.in = inputStream;
}
}
@@ -0,0 +1,646 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.nre.util.BogTranscoderInputStream
* com.tridium.sys.Nre
* javax.baja.file.BAbstractFile
* javax.baja.file.BDirectory
* javax.baja.file.BFileSpace
* javax.baja.file.BFileSystem
* javax.baja.file.BIFile
* javax.baja.file.BIFileStore
* javax.baja.file.BLocalFileStore
* javax.baja.file.FilePath
* javax.baja.file.FileUtil
* javax.baja.file.zip.BZipFile
* javax.baja.file.zip.BZipSpace
* javax.baja.log.Log
* javax.baja.net.HttpConnection
* javax.baja.security.AuthenticationException
* javax.baja.sys.BAbsTime
* javax.baja.sys.BajaRuntimeException
* javax.baja.sys.LocalizableRuntimeException
* javax.baja.util.Lexicon
* javax.baja.xml.XElem
* javax.baja.xml.XParser
*/
package com.tridium.platform.daemon;
import com.tridium.nre.util.BogTranscoderInputStream;
import com.tridium.platform.BFilesystemAttributes;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.DaemonText;
import com.tridium.platform.daemon.file.BDaemonFileSpace;
import com.tridium.platform.daemon.file.BDaemonFileStore;
import com.tridium.platform.daemon.file.FileCache;
import com.tridium.platform.daemon.file.FileHeaderInfo;
import com.tridium.platform.daemon.file.FilePathComparator;
import com.tridium.platform.daemon.message.FileHeaderMessage;
import com.tridium.platform.daemon.message.FileTransferMessage;
import com.tridium.platform.daemon.message.FileTransferMessageElement;
import com.tridium.platform.daemon.message.GetJarContentMessage;
import com.tridium.platform.daemon.message.XmlResponseMessage;
import com.tridium.platform.daemon.task.CancelableDaemonSessionTask;
import com.tridium.platform.daemon.task.DaemonSessionTaskListener;
import com.tridium.sys.Nre;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ConnectException;
import java.text.DecimalFormat;
import java.util.TreeSet;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import javax.baja.file.BAbstractFile;
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.file.FileUtil;
import javax.baja.file.zip.BZipFile;
import javax.baja.file.zip.BZipSpace;
import javax.baja.log.Log;
import javax.baja.net.HttpConnection;
import javax.baja.platform.ICancelHint;
import javax.baja.security.AuthenticationException;
import javax.baja.sys.BAbsTime;
import javax.baja.sys.BajaRuntimeException;
import javax.baja.sys.LocalizableRuntimeException;
import javax.baja.util.Lexicon;
import javax.baja.xml.XElem;
import javax.baja.xml.XParser;
public class DaemonFileUtil {
public static Lexicon lex = Lexicon.make((String)"platform");
public static DecimalFormat kbFormat = new DecimalFormat(lex.getText("Formats.kb"));
public static DecimalFormat byteFormat = new DecimalFormat(lex.getText("Formats.bytes"));
public static Log log = Log.getLog((String)"platform.daemonSession");
public static void deleteFile(BIFile bIFile) throws Exception {
BFileSpace bFileSpace = (BFileSpace)bIFile.getSpace();
if (bFileSpace instanceof BDaemonFileSpace) {
BDaemonFileSpace bDaemonFileSpace = (BDaemonFileSpace)bFileSpace;
DaemonFileUtil.transfer(bDaemonFileSpace.getDaemonSession(), FileTransferMessage.makeDelete(bIFile.getFilePath(), bDaemonFileSpace), null);
} else {
bIFile.delete();
}
}
public static String fileSize(long l) {
if (l < 0L) {
return "";
}
if (l < 1024L) {
return byteFormat.format(l);
}
return kbFormat.format((double)l / 1024.0);
}
public static void pipe(InputStream inputStream, OutputStream outputStream, TransferStatus transferStatus) throws IOException {
int n = 4096;
byte[] byArray = new byte[n];
long l = 0L;
while (true) {
if (transferStatus.isCanceled()) {
throw new ICancelHint.CanceledException();
}
int n2 = inputStream.read(byArray, 0, n);
if (n2 < 0) break;
outputStream.write(byArray, 0, n2);
transferStatus.updateBytesWritten(l += (long)n2);
}
}
public static BIFile findFile(BFileSpace bFileSpace, FilePath filePath, FileCache fileCache) {
if (fileCache == null) {
return bFileSpace.findFile(filePath);
}
switch (fileCache.getCacheStatus(filePath)) {
case 0: {
return fileCache.getFile(filePath);
}
case 1: {
return null;
}
}
BIFile bIFile = bFileSpace.findFile(filePath);
if (bIFile == null) {
fileCache.cacheNotFound(filePath);
} else {
fileCache.cacheResult(bIFile);
}
return bIFile;
}
public static long getCrc(BIFile bIFile) {
try {
if (bIFile instanceof BAbstractFile) {
return ((BAbstractFile)bIFile).getCrc();
}
return -1;
}
catch (IOException iOException) {
throw new LocalizableRuntimeException("platform", "FileUtilities.exception.readCrc", (Throwable)iOException);
}
}
public static FileHeaderInfo getFileHeaderInfo(BDaemonSession bDaemonSession, FileHeaderMessage fileHeaderMessage) throws ConnectException, AuthenticationException {
String string;
long l;
String string2;
HttpConnection httpConnection = bDaemonSession.getConnection(fileHeaderMessage.getMessageString(), "HEAD", BDaemonSession.DEFAULT_TIMEOUT);
if (httpConnection == null) {
return null;
}
FileHeaderInfo fileHeaderInfo = new FileHeaderInfo();
String string3 = httpConnection.getResponseHeader("Content-Type");
if (string3 != null) {
fileHeaderInfo.setContentType(string3);
}
if ((string2 = httpConnection.getResponseHeader("Content-Length")) != null) {
fileHeaderInfo.setContentLength(Long.parseLong(string2));
}
if ((l = httpConnection.getResponseHeaderDate("Last-Modified")) > 0L) {
fileHeaderInfo.setLastModified(BAbsTime.make((long)l));
}
if ((string = httpConnection.getResponseHeader("File-CRC")) != null) {
fileHeaderInfo.setCrc(Long.parseLong(string));
}
httpConnection.close();
return fileHeaderInfo;
}
public static BFilesystemAttributes getFilesystemAttributes(BDaemonSession bDaemonSession, FilePath filePath) throws Exception {
InputStream inputStream = bDaemonSession.getInputStream(new FilesystemAttributesMessage(bDaemonSession.getFileSpace(), filePath));
XElem xElem = XParser.make((InputStream)inputStream).parse();
return new BFilesystemAttributes(xElem.getl("totalKb", (long)-1), xElem.getl("freeKb", (long)-1), xElem.geti("blockSize", -1), xElem.getl("maxFileCount", (long)-1), xElem.getl("currentFileCount", (long)-1), xElem.getb("isFlash", false));
}
public static FilePath getNormalizedFilePath(BIFileStore bIFileStore) {
if (bIFileStore.getFilePath().isLocalAbsolute()) {
return bIFileStore.getFilePath();
}
if (bIFileStore.getFileSpace() instanceof BDaemonFileSpace) {
FilePath filePath = ((BDaemonFileSpace)bIFileStore.getFileSpace()).getAltPath(bIFileStore.getFilePath());
if (filePath != null) {
return filePath;
}
} else if (bIFileStore instanceof BLocalFileStore) {
return BFileSystem.INSTANCE.localFileToPath(((BLocalFileStore)bIFileStore).getLocalFile());
}
return bIFileStore.getFilePath();
}
public static InputStream getZipStream(BIFile bIFile, FilePath filePath) throws IOException {
ZipEntry zipEntry;
if (bIFile.getStore() instanceof BLocalFileStore) {
BZipFile bZipFile = bIFile instanceof BZipFile ? (BZipFile)bIFile : new BZipFile(bIFile.getStore());
BZipSpace bZipSpace = (BZipSpace)bZipFile.open();
BIFile bIFile2 = bZipSpace.findFile(filePath);
if (bIFile2 == null) {
try {
bZipFile.close();
}
catch (Exception exception) {}
return null;
}
return new ZipEntryInputStream(bZipFile, bIFile2);
}
if (bIFile.getStore() instanceof BDaemonFileStore) {
BDaemonFileStore bDaemonFileStore = (BDaemonFileStore)bIFile.getStore();
return bDaemonFileStore.getDaemonSession().getInputStream(new GetJarContentMessage(bIFile.getFilePath(), filePath));
}
ZipInputStream zipInputStream = new ZipInputStream(bIFile.getInputStream());
while ((zipEntry = zipInputStream.getNextEntry()) != null) {
if (!zipEntry.getName().equalsIgnoreCase(filePath.getBody())) continue;
return zipInputStream;
}
zipInputStream.close();
return null;
}
public static boolean isSubPath(FilePath filePath, FilePath filePath2) {
return DaemonFileUtil.pathsMatch(filePath, filePath2, filePath2.depth());
}
public static BIFile[] listFiles(BDirectory bDirectory, FileCache fileCache) {
BIFile[] bIFileArray = bDirectory.listFiles();
if (fileCache != null) {
int n = 0;
while (n < bIFileArray.length) {
fileCache.cacheResult(bIFileArray[n]);
++n;
}
}
return bIFileArray;
}
public static boolean pathsMatch(FilePath filePath, FilePath filePath2, int n) {
if (filePath.getAbsoluteMode() != filePath2.getAbsoluteMode()) {
return false;
}
if (filePath.depth() < n) {
return false;
}
if (filePath2.depth() < n) {
return false;
}
int n2 = 0;
while (n2 < n) {
if (!filePath.nameAt(n2).equals(filePath2.nameAt(n2))) {
return false;
}
++n2;
}
return true;
}
public static boolean transfer(BDaemonSession bDaemonSession, FileTransferMessage fileTransferMessage, ICancelHint iCancelHint) throws ConnectException, AuthenticationException {
return DaemonFileUtil.transfer(bDaemonSession, fileTransferMessage, iCancelHint, DaemonSessionTaskListener.NULL_TASK_LISTENER);
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* WARNING - Removed back jump from a try to a catch block - possible behaviour change.
* Unable to fully structure code
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public static synchronized boolean transfer(BDaemonSession var0, FileTransferMessage var1_1, ICancelHint var2_2, DaemonSessionTaskListener var3_3) throws ConnectException, AuthenticationException {
block47: {
block46: {
block44: {
if (DaemonFileUtil.canceled(var2_2)) {
throw new ICancelHint.CanceledException();
}
var4_4 = new CancelableDaemonSessionTask(DaemonFileUtil.lex, "DaemonSession.transferFiles.taskTitle", "DaemonSession.transferFiles.taskMessage", 100, var2_2);
if (var3_3 == null) {
var3_3 = DaemonSessionTaskListener.NULL_TASK_LISTENER;
}
var5_5 = null;
var6_6 = false;
var7_7 = true;
var1_1.initProgress();
var4_4.setProgress(var1_1.getProgress());
var3_3.taskStarted(var4_4);
try {
var11_8 = null;
var12_9 = "";
var13_10 = var1_1.getElements(var0);
var14_11 = var13_10.iterator();
block20: while (true) {
block45: {
block48: {
if (var14_11.hasNext()) break block48;
var1_1.getCache().clear();
try {
if (!var6_6) ** GOTO lbl-1000
var4_4.setIsCancelEnabled(false);
var3_3.taskUpdated(var4_4);
if (DaemonFileUtil.sendCommit(var0, var1_1, var11_8, var4_4, var3_3)) {
var17_16 = new TreeSet<E>(FilePathComparator.INSTANCE);
var18_40 = new TreeSet<E>(FilePathComparator.INSTANCE);
var19_19 = 0;
while (true) {
if (var19_19 >= var13_10.size()) {
var0.getFileSpace().notify(var17_16, var18_40);
var10_26 = true;
var15_13 = null;
if (var11_8 != null) {
break block20;
}
break block44;
}
((FileTransferMessageElement)var13_10.get(var19_19)).updateTransferInfo(var17_16, var18_40);
++var19_19;
}
}
** GOTO lbl-1000
}
catch (Throwable var14_12) {
var15_13 = null;
if (var11_8 == null) throw var14_12;
var11_8.close();
throw var14_12;
}
}
if (DaemonFileUtil.canceled(var4_4)) {
DaemonFileUtil.sendAbort(var0, var1_1, var11_8, var4_4, var3_3);
var1_1.getCache().clear();
throw new ICancelHint.CanceledException();
}
var15_13 = (FileTransferMessageElement)var14_11.next();
var12_9 = var15_13.getFullUri(var1_1, var7_7);
var7_7 = false;
if (var15_13.getRequestMethod().equals("POST")) {
var4_4.setMessage(DaemonFileUtil.lex.getText("FileTransferMessageElement.progress", new Object[]{var15_13.getFilePath().getBody()}));
} else if (var15_13.getRequestMethod().equals("DELETE")) {
var4_4.setMessage(DaemonFileUtil.lex.getText("DeleteFileTransferMessageElement.progress", new Object[]{var15_13.getFilePath().getBody()}));
}
var3_3.taskUpdated(var4_4);
var16_14 = var15_13.getRequestMethod().equals("POST") != false ? 32 : 0;
var17_15 = var15_13.getSize();
if (var15_13.getFilePath().getName().endsWith(".bog")) {
try {
var19_17 = var15_13.getStream();
if (var19_17 != null) {
var20_20 = new BogTranscoderInputStream(Nre.getSecurityInfoProvider().getKeyRing(), (InputStream)var19_17, true);
var21_23 = FileUtil.getFileInfo((InputStream)var20_20);
var20_20.close();
var17_15 = var21_23.size;
}
}
catch (IOException var19_18) {
var19_18.printStackTrace();
}
}
if ((var11_8 = var0.getConnection(var12_9, var15_13.getRequestMethod(), var17_15, BDaemonSession.DEFAULT_TIMEOUT, var11_8, var16_14)) == null) {
DaemonFileUtil.sendAbort(var0, var1_1, var11_8, var4_4, var3_3);
var1_1.getCache().clear();
var10_25 = false;
var9_29 = null;
var3_3.taskFinished(var4_4);
return var10_25;
}
if (var5_5 == null && (var5_5 = var11_8.getResponseHeader("transactionId")) != null) {
var1_1.setTransactionId(var5_5);
var6_6 = true;
}
if (var15_13.getRequestMethod().equals("POST")) {
var19_17 = (TreeSet<E>)new byte[4096];
try {
var21_23 = var15_13.getFilePath().getName().endsWith(".bog") != false ? new BogTranscoderInputStream(Nre.getSecurityInfoProvider().getKeyRing(), var15_13.getStream()) : var15_13.getStream();
var1_1.updateProgress(var15_13, 0);
var4_4.setProgress(var1_1.getProgress());
var3_3.taskUpdated(var4_4);
if (DaemonFileUtil.canceled(var4_4)) {
try {
try {
var11_8.close();
}
catch (Exception v0) {}
}
catch (Throwable var22_34) {
var23_36 = null;
var11_8 = null;
throw var22_34;
}
{
var23_37 = null;
var11_8 = null;
}
DaemonFileUtil.sendAbort(var0, var1_1, var11_8, var4_4, var3_3);
var1_1.getCache().clear();
var21_23.close();
throw new ICancelHint.CanceledException();
}
while (true) {
if ((var20_21 = var21_23.read((byte[])var19_17, 0, ((TreeSet<E>)var19_17).length)) <= 0) {
var21_23.close();
var11_8.postComplete();
var0.readFully(var11_8);
break block45;
}
if (DaemonFileUtil.canceled(var4_4)) {
try {
try {
var11_8.close();
}
catch (Exception v1) {}
}
catch (Throwable var22_35) {
var23_38 = null;
var11_8 = null;
throw var22_35;
}
{
var23_39 = null;
var11_8 = null;
}
DaemonFileUtil.sendAbort(var0, var1_1, var11_8, var4_4, var3_3);
var1_1.getCache().clear();
throw new ICancelHint.CanceledException();
}
var11_8.getOutputStream().write((byte[])var19_17, 0, var20_21);
var1_1.updateProgress(var15_13, var20_21);
var4_4.setProgress(var1_1.getProgress());
var3_3.taskUpdated(var4_4);
}
}
catch (IOException var21_24) {
DaemonFileUtil.log.trace("transfer(FileTransferMessage) closes connection a");
if (var11_8 == null) throw new LocalizableRuntimeException("platform", "DaemonSession.exception.write", new Object[]{var0.getAddressString(), var15_13.getRequestMethod(), var12_9}, (Throwable)var21_24);
var11_8.close();
throw new LocalizableRuntimeException("platform", "DaemonSession.exception.write", new Object[]{var0.getAddressString(), var15_13.getRequestMethod(), var12_9}, (Throwable)var21_24);
}
}
var1_1.updateProgress(var15_13, 0);
var4_4.setProgress(var1_1.getProgress());
var3_3.taskUpdated(var4_4);
var0.readFully(var11_8);
}
if (var6_6) continue;
var19_17 = new TreeSet<E>(FilePathComparator.INSTANCE);
var20_22 = new TreeSet<E>(FilePathComparator.INSTANCE);
var15_13.updateTransferInfo(var19_17, var20_22);
var0.getFileSpace().notify(var19_17, var20_22);
}
var11_8.close();
break block44;
lbl-1000:
// 1 sources
{
var10_27 = false;
var15_13 = null;
if (var11_8 == null) break block46;
}
var11_8.close();
break block46;
lbl-1000:
// 1 sources
{
var10_28 = true;
var15_13 = null;
if (var11_8 == null) break block47;
}
var11_8.close();
break block47;
}
catch (Throwable var8_41) {
var9_33 = null;
var3_3.taskFinished(var4_4);
throw var8_41;
}
}
var9_30 = null;
var3_3.taskFinished(var4_4);
return var10_26;
}
var9_31 = null;
var3_3.taskFinished(var4_4);
return var10_27;
}
var9_32 = null;
var3_3.taskFinished(var4_4);
return var10_28;
}
private static final boolean canceled(ICancelHint iCancelHint) {
boolean bl = false;
if (iCancelHint != null && iCancelHint.isCanceled()) {
bl = true;
}
return bl;
}
private static final boolean sendAbort(BDaemonSession bDaemonSession, FileTransferMessage fileTransferMessage, HttpConnection httpConnection, CancelableDaemonSessionTask cancelableDaemonSessionTask, DaemonSessionTaskListener daemonSessionTaskListener) throws ConnectException, AuthenticationException {
String string = fileTransferMessage.getAbortUri();
if (string == null) {
return true;
}
try {
httpConnection = bDaemonSession.getConnection(string, "GET", -1, BDaemonSession.DEFAULT_TIMEOUT, httpConnection);
}
catch (IOException iOException) {
log.trace("sendAbort closes connection");
if (httpConnection != null) {
httpConnection.close();
}
throw new LocalizableRuntimeException("platform", "DaemonSession.exception.write", new Object[]{bDaemonSession.getAddressString(), "GET", string}, (Throwable)iOException);
}
return true;
}
private static final boolean sendCommit(BDaemonSession bDaemonSession, FileTransferMessage fileTransferMessage, HttpConnection httpConnection, CancelableDaemonSessionTask cancelableDaemonSessionTask, DaemonSessionTaskListener daemonSessionTaskListener) throws ConnectException, AuthenticationException {
String string = fileTransferMessage.getCommitUri();
InputStream inputStream = null;
if (string == null) {
if (fileTransferMessage.getTransactionId() == null) {
log.warning("attempt to commit file transfer that is not transacted");
} else {
log.warning("attempt to commit file transfer that is autocommit");
}
return false;
}
try {
inputStream = bDaemonSession.getInputStream(string, 0, "text/xml", httpConnection);
if (inputStream == null) {
return true;
}
XParser xParser = XParser.make((InputStream)inputStream);
while (xParser.next() != -1) {
if (xParser.type() == 1) {
XElem xElem = null;
if (xParser.elem().name().equals("message")) {
xElem = xParser.parseCurrent(false);
} else if (xParser.elem().name().equals("warning")) {
xElem = xParser.parseCurrent(false);
} else if (xParser.elem().name().equals("trace")) {
xElem = xParser.parseCurrent(false);
} else if (xParser.elem().name().equals("error")) {
xElem = xParser.parseCurrent(false);
int n = xElem.geti("code", 500);
DaemonText daemonText = new DaemonText(xElem);
if (daemonText.lexModule == null) {
String string2 = daemonText.message;
if (string2 == null) {
string2 = bDaemonSession.getAddressString() + " GET " + string;
}
if (n >= 400) {
throw new LocalizableRuntimeException("platform", "DaemonSession.exception.commit", new Object[]{string2});
}
} else if (n >= 300) {
throw new LocalizableRuntimeException(daemonText.lexModule, daemonText.lexKey, daemonText.lexArgs);
}
}
if (xElem == null) continue;
DaemonText daemonText = new DaemonText(xElem);
cancelableDaemonSessionTask.setMessage(daemonText.message);
daemonSessionTaskListener.taskUpdated(cancelableDaemonSessionTask);
continue;
}
if (xParser.type() != 2 || xParser.depth() > 1) {
continue;
}
break;
}
}
catch (IOException iOException) {
log.trace("sendCommit closes connection");
try {
if (inputStream != null) {
inputStream.close();
} else if (httpConnection != null) {
httpConnection.close();
}
}
catch (Exception exception) {}
throw new LocalizableRuntimeException("platform", "DaemonSession.exception.commit", new Object[]{bDaemonSession.getAddressString(), "GET", string}, (Throwable)iOException);
}
catch (AuthenticationException authenticationException) {
throw authenticationException;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
return true;
}
public static interface TransferStatus
extends ICancelHint {
public void updateBytesWritten(long var1);
}
private static class FilesystemAttributesMessage
extends XmlResponseMessage {
StringBuffer path = new StringBuffer();
public String getMessageString() {
return this.path.toString();
}
public FilesystemAttributesMessage(BDaemonFileSpace bDaemonFileSpace, FilePath filePath) {
this.path.append(bDaemonFileSpace.filePathToUri(filePath));
this.path.append("?fsinfo=true");
}
}
public static class ZipEntryInputStream
extends InputStream {
private InputStream stream;
private BZipFile zipFile;
public int read() throws IOException {
return this.stream.read();
}
public int read(byte[] byArray) throws IOException {
return this.stream.read(byArray);
}
public int read(byte[] byArray, int n, int n2) throws IOException {
return this.stream.read(byArray, n, n2);
}
public void close() throws IOException {
this.stream.close();
this.zipFile.close();
}
public ZipEntryInputStream(BZipFile bZipFile, BIFile bIFile) throws IOException {
this.zipFile = bZipFile;
this.stream = bIFile.getInputStream();
}
}
}
@@ -0,0 +1,27 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.net.Http
* javax.baja.sys.LocalizableRuntimeException
*/
package com.tridium.platform.daemon;
import javax.baja.net.Http;
import javax.baja.sys.LocalizableRuntimeException;
public class DaemonResponseException
extends LocalizableRuntimeException {
public int responseCode;
public DaemonResponseException(int n, String string, String string2, String string3) {
super("platform", "DaemonSession.exception.badConnectResponse", new Object[]{Http.getReasonPhrase((int)n), string, string2, string3});
this.responseCode = n;
}
public DaemonResponseException(int n, String string, String string2) {
super("platform", "DaemonSession.exception.serverProvided", new Object[]{string, string2});
this.responseCode = n;
}
}
@@ -0,0 +1,36 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.net.HttpConnection
*/
package com.tridium.platform.daemon;
import com.tridium.platform.daemon.DaemonResponseException;
import javax.baja.net.HttpConnection;
public class DaemonSSLRequiredException
extends DaemonResponseException {
private static final long serialVersionUID = 1L;
private String newLocation;
public String getNewLocation() {
return this.newLocation;
}
public DaemonSSLRequiredException(int n, String string, String string2, String string3, String string4) {
super(n, string, string2, string3);
this.newLocation = string4;
}
public DaemonSSLRequiredException(int n, String string, String string2, String string3) {
super(n, string, string2);
this.newLocation = string3;
}
public DaemonSSLRequiredException(HttpConnection httpConnection, int n, String string, String string2, String string3) {
super(n, string, string2);
this.newLocation = string3;
}
}
@@ -0,0 +1,15 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platform.daemon;
import com.tridium.platform.daemon.BDaemonSession;
public interface DaemonSessionListener {
public void sessionConnected(BDaemonSession var1);
public void sessionDisconnected(BDaemonSession var1);
public void sessionConnectionError(BDaemonSession var1, Throwable var2);
}
@@ -0,0 +1,53 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.util.Lexicon
* javax.baja.xml.XElem
*/
package com.tridium.platform.daemon;
import javax.baja.util.Lexicon;
import javax.baja.xml.XElem;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
class DaemonText {
public String lexModule;
public String lexKey;
public Object[] lexArgs;
public String message;
private final /* synthetic */ void this() {
this.lexModule = null;
this.lexKey = null;
this.lexArgs = new Object[0];
this.message = null;
}
public DaemonText(XElem xElem) {
XElem xElem2;
this.this();
XElem xElem3 = xElem.elem("message");
if (xElem3 == null) {
xElem3 = xElem;
}
if ((xElem2 = xElem3.elem("localized")) == null) {
XElem xElem4 = xElem3.elem("nonlocalized");
this.message = xElem4 == null ? "" : xElem4.get("text");
} else {
XElem[] xElemArray = xElem2.elems("lexArg");
this.lexArgs = new Object[xElemArray.length];
int n = 0;
while (n < xElemArray.length) {
this.lexArgs[n] = xElemArray[n].get("value");
++n;
}
this.lexModule = xElem2.get("module");
this.lexKey = xElem2.get("key");
this.message = Lexicon.make((String)this.lexModule).getText(this.lexKey, this.lexArgs);
}
}
}
@@ -0,0 +1,414 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.timezone.HistoricalTimeZone
* com.tridium.timezone.TzJarUtil
* com.tridium.timezone.TzXmlDecoder
* javax.baja.file.FilePath
* javax.baja.nre.util.Array
* javax.baja.security.AuthenticationException
* javax.baja.sys.BAbsTime
* javax.baja.sys.BMonth
* javax.baja.sys.BajaRuntimeException
* javax.baja.timezone.BTimeZone
* javax.baja.xml.XElem
* javax.baja.xml.XParser
*/
package com.tridium.platform.daemon;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.DaemonFileUtil;
import com.tridium.platform.daemon.file.BDaemonFileStore;
import com.tridium.platform.daemon.file.FileHeaderInfo;
import com.tridium.platform.daemon.message.FileHeaderMessage;
import com.tridium.platform.daemon.message.GetTimeMessage;
import com.tridium.platform.daemon.message.UpdateTimeMessage;
import com.tridium.platform.timezone.TimeZoneUtil;
import com.tridium.timezone.HistoricalTimeZone;
import com.tridium.timezone.TzJarUtil;
import com.tridium.timezone.TzXmlDecoder;
import java.io.InputStream;
import java.net.ConnectException;
import javax.baja.file.FilePath;
import javax.baja.nre.util.Array;
import javax.baja.security.AuthenticationException;
import javax.baja.sys.BAbsTime;
import javax.baja.sys.BMonth;
import javax.baja.sys.BajaRuntimeException;
import javax.baja.timezone.BTimeZone;
import javax.baja.xml.XElem;
import javax.baja.xml.XParser;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class DaemonTimeUtil {
static /* synthetic */ Class class$javax$baja$timezone$BTimeZone;
public static BAbsTime getLocalTime(BDaemonSession bDaemonSession) throws ConnectException, AuthenticationException {
return DaemonTimeUtil.getLocalTime(bDaemonSession, null, null);
}
public static BAbsTime getLocalTime(BDaemonSession bDaemonSession, BTimeZone bTimeZone, BTimeZone[] bTimeZoneArray) throws ConnectException, AuthenticationException {
XElem xElem = DaemonTimeUtil.getCurrentTimeElem(bDaemonSession);
return DaemonTimeUtil.getLocalTime(bDaemonSession, xElem, bTimeZone, bTimeZoneArray);
}
public static BAbsTime getLocalTime(BDaemonSession bDaemonSession, XElem xElem, BTimeZone bTimeZone, BTimeZone[] bTimeZoneArray) throws ConnectException, AuthenticationException {
if (bTimeZone == null) {
if (bTimeZoneArray == null) {
bTimeZoneArray = DaemonTimeUtil.getLocalTimeZones(bDaemonSession);
}
bTimeZone = DaemonTimeUtil.getLocalTimeZone(xElem, bTimeZoneArray);
}
return DaemonTimeUtil.getLocalTime(bDaemonSession, xElem, bTimeZone);
}
private static final BAbsTime getLocalTime(BDaemonSession bDaemonSession, XElem xElem, BTimeZone bTimeZone) throws ConnectException, AuthenticationException {
if (xElem == null) {
return null;
}
if (xElem.get("millis", null) == null) {
return BAbsTime.make((int)xElem.geti("year"), (BMonth)BMonth.make((int)xElem.geti("month")), (int)xElem.geti("day"), (int)xElem.geti("hour"), (int)xElem.geti("minute"), (int)xElem.geti("second"), (int)0, (BTimeZone)bTimeZone);
}
return BAbsTime.make((long)xElem.getl("millis"), (BTimeZone)bTimeZone);
}
public static BTimeZone getEquivalentTimeZone(BTimeZone bTimeZone, BDaemonSession bDaemonSession) throws ConnectException, AuthenticationException {
return DaemonTimeUtil.getEquivalentTimeZone(bTimeZone, DaemonTimeUtil.getLocalTimeZones(bDaemonSession));
}
public static BTimeZone getEquivalentTimeZone(BTimeZone bTimeZone, BTimeZone[] bTimeZoneArray) {
if (bTimeZoneArray == null) {
return null;
}
try {
BTimeZone bTimeZone2 = null;
if (bTimeZone.getId().equals("STD")) {
bTimeZone = BTimeZone.UTC;
}
int n = 0;
while (n < bTimeZoneArray.length) {
if (TimeZoneUtil.isEquivalent(bTimeZone, bTimeZoneArray[n])) {
if (bTimeZone.getId().equals(bTimeZoneArray[n].getId())) {
return bTimeZoneArray[n];
}
if (bTimeZone2 == null) {
bTimeZone2 = bTimeZoneArray[n];
}
}
++n;
}
return bTimeZone2;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public static BTimeZone getLocalTimeZone(BDaemonSession bDaemonSession) throws ConnectException, AuthenticationException {
return DaemonTimeUtil.getLocalTimeZone(bDaemonSession, DaemonTimeUtil.getLocalTimeZones(bDaemonSession));
}
public static XElem getCurrentTimeElem(BDaemonSession bDaemonSession) throws ConnectException, AuthenticationException {
try {
InputStream inputStream = bDaemonSession.getInputStream(GetTimeMessage.getInstance());
if (inputStream == null) {
return null;
}
return XParser.make((InputStream)inputStream).parse();
}
catch (ConnectException connectException) {
throw connectException;
}
catch (AuthenticationException authenticationException) {
throw authenticationException;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public static BTimeZone getLocalTimeZone(BDaemonSession bDaemonSession, BTimeZone[] bTimeZoneArray) throws ConnectException, AuthenticationException {
return DaemonTimeUtil.getLocalTimeZone(DaemonTimeUtil.getCurrentTimeElem(bDaemonSession), bTimeZoneArray);
}
public static BTimeZone getOsTimeZone(BDaemonSession bDaemonSession) throws Exception {
XElem xElem = DaemonTimeUtil.getCurrentTimeElem(bDaemonSession);
if (xElem == null) {
return null;
}
XElem xElem2 = xElem.elem("zone");
if (xElem2 == null) {
return null;
}
try {
return TzXmlDecoder.getTimeZone((XElem)xElem2, (boolean)false);
}
catch (Exception exception) {
exception.printStackTrace();
return BTimeZone.UTC;
}
}
public static BTimeZone getLocalTimeZone(XElem xElem, BTimeZone[] bTimeZoneArray) throws ConnectException, AuthenticationException {
BTimeZone bTimeZone;
XElem xElem2;
if (xElem == null) {
return null;
}
String string = xElem.get("timeZone", "UTC");
if (string.trim().length() > 0 && bTimeZoneArray != null) {
int n = 0;
while (n < bTimeZoneArray.length) {
if (bTimeZoneArray[n].getId().equals(string)) {
return bTimeZoneArray[n];
}
++n;
}
}
if ((xElem2 = xElem.elem("zone")) == null) {
return BTimeZone.UTC;
}
try {
bTimeZone = TzXmlDecoder.getTimeZone((XElem)xElem2, (boolean)false);
if (bTimeZone.getId().equals("STD") || bTimeZone.getId().equals("DST")) {
if (TimeZoneUtil.isEquivalent(bTimeZone, BTimeZone.UTC)) {
bTimeZone = BTimeZone.UTC;
} else if (TimeZoneUtil.isEquivalent(bTimeZone, BTimeZone.getLocal())) {
bTimeZone = BTimeZone.getLocal();
}
}
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
if (bTimeZoneArray != null) {
BTimeZone bTimeZone2 = null;
int n = 0;
while (n < bTimeZoneArray.length) {
if (TimeZoneUtil.isEquivalent(bTimeZoneArray[n], bTimeZone)) {
if (bTimeZoneArray[n].getId().equals(bTimeZone.getId())) {
return bTimeZoneArray[n];
}
bTimeZone2 = bTimeZoneArray[n];
}
++n;
}
if (bTimeZone2 != null) {
return bTimeZone2;
}
}
return BTimeZone.UTC;
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Loose catch block
* Enabled aggressive exception aggregation
*/
public static BTimeZone[] getLocalTimeZones(BDaemonSession bDaemonSession) throws ConnectException, AuthenticationException {
try {
BTimeZone[] bTimeZoneArray;
BTimeZone[] bTimeZoneArray2;
Class clazz = class$javax$baja$timezone$BTimeZone;
if (clazz == null) {
clazz = class$javax$baja$timezone$BTimeZone = DaemonTimeUtil.class("[Ljavax.baja.timezone.BTimeZone;", false);
}
Array array = new Array(clazz);
BDaemonFileStore bDaemonFileStore = new BDaemonFileStore(bDaemonSession.getFileSpace(), new FilePath("!lib/timezones.jar"));
InputStream inputStream = null;
inputStream = bDaemonFileStore.getInputStream();
if (inputStream != null) break block25;
BDaemonFileStore bDaemonFileStore2 = new BDaemonFileStore(bDaemonSession.getFileSpace(), new FilePath("!lib/timezones.xml"));
InputStream inputStream2 = null;
inputStream2 = bDaemonFileStore2.getInputStream();
if (inputStream2 != null) break block21;
BTimeZone[] bTimeZoneArray3 = new BTimeZone[]{DaemonTimeUtil.getOsTimeZone(bDaemonSession)};
Object var11_13 = null;
try {
inputStream2.close();
}
catch (Exception exception) {
}
Object var5_16 = null;
try {
inputStream.close();
}
catch (Exception exception) {}
{
block21: {
return bTimeZoneArray3;
}
XElem xElem = XParser.make((InputStream)inputStream2).parse();
XElem[] xElemArray = xElem.elems("zone");
int n = 0;
while (n < xElemArray.length) {
array.add((Object)TzXmlDecoder.getTimeZone((XElem)xElemArray[n], (boolean)false));
++n;
}
array = array.sort(TimeZoneUtil.TZ_COMPARATOR);
bTimeZoneArray2 = (BTimeZone[])array.trim();
Object var11_14 = null;
try {
inputStream2.close();
}
catch (Exception exception) {
}
}
Object var5_17 = null;
try {
inputStream.close();
}
catch (Exception exception) {}
{
block25: {
return bTimeZoneArray2;
catch (Throwable throwable) {
Object var11_15 = null;
try {
inputStream2.close();
}
catch (Exception exception) {}
throw throwable;
}
}
array.addAll(TzJarUtil.getTimeZones((InputStream)inputStream));
array = array.sort(TimeZoneUtil.TZ_COMPARATOR);
bTimeZoneArray = (BTimeZone[])array.trim();
}
Object var5_18 = null;
try {
inputStream.close();
}
catch (Exception exception) {}
return bTimeZoneArray;
catch (Throwable throwable) {
Object var5_19 = null;
try {
inputStream.close();
}
catch (Exception exception) {}
throw throwable;
}
}
catch (ConnectException connectException) {
throw connectException;
}
catch (AuthenticationException authenticationException) {
throw authenticationException;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public static BTimeZone getCompleteTimeZone(BDaemonSession bDaemonSession, BTimeZone bTimeZone) throws ConnectException, AuthenticationException {
try {
BDaemonFileStore bDaemonFileStore = new BDaemonFileStore(bDaemonSession.getFileSpace(), new FilePath("!lib/timezones.jar"));
FileHeaderInfo fileHeaderInfo = DaemonFileUtil.getFileHeaderInfo(bDaemonSession, new FileHeaderMessage(bDaemonFileStore.getFilePath(), bDaemonFileStore.getDaemonFileSpace()));
if (fileHeaderInfo == null) {
BTimeZone bTimeZone2;
InputStream inputStream;
block16: {
BTimeZone bTimeZone3;
block15: {
BDaemonFileStore bDaemonFileStore2 = new BDaemonFileStore(bDaemonSession.getFileSpace(), new FilePath("!lib/timezones.xml"));
inputStream = null;
try {
inputStream = bDaemonFileStore2.getInputStream();
if (inputStream == null) {
bTimeZone3 = bTimeZone;
Object var7_14 = null;
break block15;
}
XElem xElem = XParser.make((InputStream)inputStream).parse();
XElem[] xElemArray = xElem.elems("zone");
BTimeZone bTimeZone4 = null;
int n = 0;
while (n < xElemArray.length && !(bTimeZone4 = TzXmlDecoder.getTimeZone((XElem)xElemArray[n])).getId().equalsIgnoreCase(bTimeZone.getId())) {
++n;
}
bTimeZone2 = bTimeZone4;
break block16;
}
catch (Throwable throwable) {
Object var7_16 = null;
try {
inputStream.close();
throw throwable;
}
catch (Exception exception) {}
throw throwable;
}
}
try {}
catch (Exception exception) {}
inputStream.close();
return bTimeZone3;
}
Object var7_15 = null;
try {}
catch (Exception exception) {}
inputStream.close();
return bTimeZone2;
}
HistoricalTimeZone historicalTimeZone = TzJarUtil.getCompleteTimeZone((String)bTimeZone.getId());
if (historicalTimeZone == null) {
return bTimeZone;
}
BTimeZone bTimeZone5 = (BTimeZone)BTimeZone.DEFAULT.fw(1102, (Object)historicalTimeZone, null, null, null);
if (bTimeZone5 != null) return bTimeZone5;
return bTimeZone;
}
catch (ConnectException connectException) {
throw connectException;
}
catch (AuthenticationException authenticationException) {
throw authenticationException;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public static void updateLocalTime(BDaemonSession bDaemonSession, BAbsTime bAbsTime, String string, BTimeZone bTimeZone) throws ConnectException, AuthenticationException {
bDaemonSession.sendMessage(new UpdateTimeMessage(bAbsTime, string, TimeZoneUtil.makeCompatible(bAbsTime.getMillis(), bTimeZone, bDaemonSession.getHostProperties().getTimezoneDayModeSupport())));
}
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());
}
}
}
@@ -0,0 +1,123 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.naming.BHost
* javax.baja.net.HttpConnection
* javax.baja.security.BICredentials
* javax.baja.security.BUsernameAndPassword
*/
package com.tridium.platform.daemon;
import com.tridium.platform.daemon.Authenticator;
import com.tridium.platform.daemon.BDaemonSession;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.security.SecureRandom;
import java.util.Properties;
import java.util.Random;
import javax.baja.naming.BHost;
import javax.baja.net.HttpConnection;
import javax.baja.security.BICredentials;
import javax.baja.security.BUsernameAndPassword;
public class DigestAuthenticator
extends Authenticator {
private static Random clientRandom;
private BHost host;
private int port;
private int nc;
private String realm;
public BHost getHost() {
return this.host;
}
public int getPort() {
return this.port;
}
public String getAuthenticationScheme() {
return "HTTP-Digest";
}
public boolean setAuthorization(HttpConnection httpConnection, String string) throws IOException {
Properties properties = DigestAuthenticator.parseHeader(httpConnection, "WWW-Authenticate");
return this.setAuthorization(httpConnection, string, properties);
}
public boolean setAuthorization(HttpConnection httpConnection, String string, Properties properties) throws IOException {
if (properties == null) {
return false;
}
String string2 = properties.getProperty("realm");
String string3 = properties.getProperty("nonce");
String string4 = properties.getProperty("qop");
if (string3 == null || this.getUserAndPwd() == null) {
return false;
}
++this.nc;
String string5 = this.getCnonce();
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("Digest username=").append(DigestAuthenticator.quote(this.getUserAndPwd().getUsername())).append(", ");
stringBuffer.append("realm=").append(DigestAuthenticator.quote(string2)).append(", ");
stringBuffer.append("nonce=").append(DigestAuthenticator.quote(string3)).append(", ");
stringBuffer.append("uri=").append(DigestAuthenticator.quote(string)).append(", ");
stringBuffer.append("nc=").append(this.nc).append(", ");
stringBuffer.append("qop=").append(DigestAuthenticator.unquote(string4)).append(", ");
stringBuffer.append("cnonce=\"").append(string5).append("\", ");
stringBuffer.append("response=\"");
stringBuffer.append(this.hexMD5(this.hexMD5(DigestAuthenticator.unquote(this.getUserAndPwd().getUsername()) + ':' + DigestAuthenticator.unquote(string2) + ':' + this.getUserAndPwd().getPassword().getValue()) + ':' + DigestAuthenticator.unquote(string3) + ':' + this.nc + ':' + string5 + ':' + DigestAuthenticator.unquote(string4) + ':' + this.hexMD5(httpConnection.getRequestMethod() + ':' + string)));
stringBuffer.append("\"");
httpConnection.setRequestHeader("Authorization", stringBuffer.toString());
return true;
}
private final String getCnonce() {
try {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream);
dataOutputStream.writeUTF("cnonce");
dataOutputStream.writeInt(this.nc);
dataOutputStream.writeUTF(this.host.getHostname());
dataOutputStream.writeInt(this.port);
dataOutputStream.writeLong(System.currentTimeMillis());
dataOutputStream.writeInt(clientRandom.nextInt());
return this.hexMD5(new String(byteArrayOutputStream.toByteArray()));
}
catch (Exception exception) {
BDaemonSession.log.error("error creating cnonce", (Throwable)exception);
return "xyzzy";
}
}
public String getAuthenticationRealmName() {
return this.realm;
}
DigestAuthenticator(BHost bHost, int n, BUsernameAndPassword bUsernameAndPassword, String string) {
this(bHost, n, string);
this.setCredentials((BICredentials)bUsernameAndPassword);
}
DigestAuthenticator(BHost bHost, int n, String string) {
this.host = bHost;
this.port = n;
this.realm = string;
}
static {
try {
clientRandom = SecureRandom.getInstance("SHA1PRNG");
}
catch (Exception exception) {
clientRandom = new SecureRandom();
}
long l = System.currentTimeMillis();
BDaemonSession.log.trace("digest authenticator starting RNG seed...");
clientRandom.nextInt();
BDaemonSession.log.trace("digest authenticator completed RNG seed [" + (System.currentTimeMillis() - l) + " ms]");
}
}
@@ -0,0 +1,188 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.nre.util.LegacyStorageUtil
* com.tridium.sys.Nre
* javax.baja.log.Log
* javax.baja.nre.util.TextUtil
* javax.baja.security.BUsernameAndPassword
* javax.baja.sys.Sys
*/
package com.tridium.platform.daemon;
import com.tridium.nre.util.LegacyStorageUtil;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.DaemonSessionListener;
import com.tridium.sys.Nre;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.ConnectException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Properties;
import javax.baja.log.Log;
import javax.baja.nre.util.TextUtil;
import javax.baja.security.BUsernameAndPassword;
import javax.baja.sys.Sys;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class LocalSessionUtil {
public static final Object MONITOR = "monitor";
private static BDaemonSession localDaemonSession;
public static Log log;
private static boolean warnedOnce;
private static DaemonSessionListener LOCAL_LISTENER;
static /* synthetic */ Class class$javax$baja$net$HttpConnection;
/*
* Exception decompiling
*/
public static BDaemonSession getLocalSession() {
/*
* This method has failed to decompile. When submitting a bug report, please provide this stack trace, and (if you hold appropriate legal rights) the relevant class file.
*
* org.benf.cfr.reader.util.ConfusedCFRException: Back jump on a try block [egrp 1[TRYBLOCK] [3 : 33->366)] java.lang.Throwable
* at org.benf.cfr.reader.bytecode.analysis.opgraph.Op02WithProcessedDataAndRefs.insertExceptionBlocks(Op02WithProcessedDataAndRefs.java:2283)
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisInner(CodeAnalyser.java:415)
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisOrWrapFail(CodeAnalyser.java:278)
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysis(CodeAnalyser.java:201)
* at org.benf.cfr.reader.entities.attributes.AttributeCode.analyse(AttributeCode.java:94)
* at org.benf.cfr.reader.entities.Method.analyse(Method.java:531)
* at org.benf.cfr.reader.entities.ClassFile.analyseMid(ClassFile.java:1055)
* at org.benf.cfr.reader.entities.ClassFile.analyseTop(ClassFile.java:942)
* at org.benf.cfr.reader.Driver.doJarVersionTypes(Driver.java:257)
* at org.benf.cfr.reader.Driver.doJar(Driver.java:139)
* at org.benf.cfr.reader.CfrDriverImpl.analyse(CfrDriverImpl.java:76)
* at org.benf.cfr.reader.Main.main(Main.java:54)
*/
throw new IllegalStateException("Decompilation failed");
}
private static final BUsernameAndPassword parseUsername(String string) throws NoSuchAlgorithmException, IOException {
String[] stringArray = TextUtil.split((String)LegacyStorageUtil.decode((String)string), (char)':');
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(stringArray[2]);
stringBuffer.append(":");
stringBuffer.append(stringArray[0]);
stringBuffer.append(":suNkiNg");
StringBuffer stringBuffer2 = new StringBuffer();
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
byte[] byArray = messageDigest.digest(stringBuffer.toString().getBytes());
int n = 0;
while (n < byArray.length) {
stringBuffer2.append(TextUtil.toLowerCase((String)TextUtil.byteToHexString((int)byArray[n])));
++n;
}
return new BUsernameAndPassword(string, stringBuffer2.toString());
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public static void resetLocalSession() {
Object object = MONITOR;
synchronized (object) {
localDaemonSession = null;
LocalSessionUtil.getLocalSession();
return;
}
}
private static final Properties getProperties() throws IOException {
Properties properties = new Properties();
File file = new File(Sys.getBajaHome() + File.separator + "daemon" + File.separator + "daemon.properties");
if (file.exists()) {
FileInputStream fileInputStream = new FileInputStream(file);
properties.load(fileInputStream);
try {
fileInputStream.close();
}
catch (Exception exception) {}
}
return properties;
}
public static boolean localDaemonIsAvailable() {
HttpURLConnection httpURLConnection = null;
boolean bl = false;
try {
BDaemonSession bDaemonSession = LocalSessionUtil.getLocalSession();
if (bDaemonSession == null) {
return false;
}
httpURLConnection = (HttpURLConnection)new URL("http", bDaemonSession.getHost().getHostname(), bDaemonSession.getPort(), "/check").openConnection();
StringBuffer stringBuffer = new StringBuffer("Niagara/");
Class clazz = class$javax$baja$net$HttpConnection;
if (clazz == null) {
clazz = class$javax$baja$net$HttpConnection = LocalSessionUtil.class("[Ljavax.baja.net.HttpConnection;", false);
}
httpURLConnection.setRequestProperty("User-Agent", stringBuffer.append(Nre.moduleManager.getModuleForClass(clazz).getVendorVersion()).toString());
boolean bl2 = false;
if (httpURLConnection.getResponseCode() < 500) {
bl2 = true;
}
bl = bl2;
}
catch (ConnectException connectException) {
}
catch (Exception exception) {
log.error("error checking for running daemon", (Throwable)exception);
}
if (httpURLConnection != null) {
httpURLConnection.disconnect();
}
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 {
log = Log.getLog((String)"platform");
warnedOnce = false;
LOCAL_LISTENER = new DaemonSessionListener(){
public final void sessionConnected(BDaemonSession bDaemonSession) {
}
public final void sessionDisconnected(BDaemonSession bDaemonSession) {
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public final void sessionConnectionError(BDaemonSession bDaemonSession, Throwable throwable) {
Object object = MONITOR;
synchronized (object) {
if (bDaemonSession == localDaemonSession) {
localDaemonSession = null;
}
return;
}
}
};
}
}
@@ -0,0 +1,129 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.file.types.text.BLicenseFile
* javax.baja.file.BDirectory
* javax.baja.file.BIFile
* javax.baja.file.FilePath
* javax.baja.nre.util.Array
* javax.baja.nre.util.IFilter
*/
package com.tridium.platform.daemon;
import com.tridium.file.types.text.BLicenseFile;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.DaemonFileUtil;
import com.tridium.platform.daemon.PlatformOperationListener;
import com.tridium.platform.daemon.message.FileTransferMessage;
import com.tridium.platform.license.LicenseInfo;
import com.tridium.platform.license.PortalLicenseUtil;
import javax.baja.file.BDirectory;
import javax.baja.file.BIFile;
import javax.baja.file.FilePath;
import javax.baja.nre.util.Array;
import javax.baja.nre.util.IFilter;
import javax.baja.platform.IPlatformOperationListener;
import javax.baja.platform.PlatformLicenseManager;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class NiagaraLicenseManager
implements PlatformLicenseManager {
private BDaemonSession session;
static /* synthetic */ Class class$com$tridium$platform$license$LicenseInfo;
public static NiagaraLicenseManager make(BDaemonSession bDaemonSession) {
return new NiagaraLicenseManager(bDaemonSession);
}
public String getHostId() throws Exception {
return this.session.getHostProperties().getHostId();
}
public BIFile[] getLicenses() throws Exception {
BDirectory bDirectory = (BDirectory)this.session.getFileSpace().findFile(new FilePath("!licenses"));
if (bDirectory == null) {
return new BIFile[0];
}
Array array = new Array((Object[])bDirectory.listFiles());
array = array.filter(new IFilter(){
public final boolean accept(Object object) {
return object instanceof BLicenseFile;
}
});
return (BIFile[])array.trim();
}
public void installLicenses(BIFile[] bIFileArray, IPlatformOperationListener iPlatformOperationListener) throws Exception {
Object object;
LicenseInfo[] licenseInfoArray;
FileTransferMessage fileTransferMessage = new FileTransferMessage(this.session.getFileSpace());
LicenseInfo[] licenseInfoArray2 = LicenseInfo.make(bIFileArray);
BDirectory bDirectory = (BDirectory)this.session.getFileSpace().findFile(new FilePath("!licenses"));
if (bDirectory == null) {
licenseInfoArray = new LicenseInfo[]{};
} else {
object = bDirectory.listFiles();
Class clazz = class$com$tridium$platform$license$LicenseInfo;
if (clazz == null) {
clazz = class$com$tridium$platform$license$LicenseInfo = NiagaraLicenseManager.class("[Lcom.tridium.platform.license.LicenseInfo;", false);
}
Array array = new Array(clazz);
int n = 0;
while (n < ((BIFile[])object).length) {
if (object[n] instanceof BLicenseFile) {
try {
array.add((Object)new LicenseInfo(object[n]));
}
catch (Exception exception) {
fileTransferMessage.addDelete(object[n].getFilePath());
}
}
++n;
}
licenseInfoArray = (LicenseInfo[])array.trim();
}
object = PortalLicenseUtil.syncLicenses(this.getHostId(), null, licenseInfoArray, licenseInfoArray2);
int n = 0;
while (n < object.toAdd.size()) {
LicenseInfo licenseInfo = (LicenseInfo)object.toAdd.get(n);
fileTransferMessage.addFile(licenseInfo.file, licenseInfo.getInstalledFilePath());
++n;
}
n = 0;
while (n < object.toUpdate.size()) {
LicenseInfo licenseInfo = (LicenseInfo)object.toUpdate.get(n);
fileTransferMessage.addFile(licenseInfo.file, licenseInfo.getInstalledFilePath());
++n;
}
n = 0;
while (n < object.toRemove.size()) {
LicenseInfo licenseInfo = (LicenseInfo)object.toRemove.get(n);
fileTransferMessage.addDelete(licenseInfo.file.getFilePath());
++n;
}
PlatformOperationListener platformOperationListener = new PlatformOperationListener(iPlatformOperationListener);
DaemonFileUtil.transfer(this.session, fileTransferMessage, platformOperationListener, platformOperationListener);
}
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 NiagaraLicenseManager(BDaemonSession bDaemonSession) {
this.session = bDaemonSession;
}
}
@@ -0,0 +1,131 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.naming.BHost
* javax.baja.security.BICredentials
* javax.baja.security.BUsernameAndPassword
*/
package com.tridium.platform.daemon;
import com.tridium.install.BRemoteDaemonPlatform;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.NiagaraLicenseManager;
import com.tridium.platform.daemon.PlatformBackupManager;
import com.tridium.platform.daemon.PlatformFileManager;
import com.tridium.platform.daemon.PlatformInstallManager;
import com.tridium.platform.daemon.PlatformSecurityManager;
import com.tridium.platform.daemon.PlatformStationManager;
import com.tridium.platform.daemon.task.DaemonSessionTaskListener;
import javax.baja.naming.BHost;
import javax.baja.platform.BackupManager;
import javax.baja.platform.DaemonSecurityManager;
import javax.baja.platform.FileManager;
import javax.baja.platform.InstallManager;
import javax.baja.platform.PlatformDaemon;
import javax.baja.platform.PlatformLicenseManager;
import javax.baja.platform.StationManager;
import javax.baja.security.BICredentials;
import javax.baja.security.BUsernameAndPassword;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class NiagaraPlatformDaemon
extends PlatformDaemon {
private BDaemonSession daemonSession;
private PlatformStationManager stationManager;
private PlatformFileManager fileManager;
private PlatformSecurityManager securityManager;
private PlatformBackupManager backupManager;
private InstallManager installManager;
private NiagaraLicenseManager licenseManager;
private BRemoteDaemonPlatform platform;
public static PlatformDaemon make(BHost bHost, int n, BUsernameAndPassword bUsernameAndPassword) throws Exception {
return new NiagaraPlatformDaemon(bHost, n, null, bUsernameAndPassword);
}
public static PlatformDaemon make(BHost bHost, int n, String[] stringArray, BUsernameAndPassword bUsernameAndPassword) throws Exception {
return new NiagaraPlatformDaemon(bHost, n, stringArray, bUsernameAndPassword);
}
public static NiagaraPlatformDaemon make(BRemoteDaemonPlatform bRemoteDaemonPlatform) {
return new NiagaraPlatformDaemon(bRemoteDaemonPlatform);
}
public static NiagaraPlatformDaemon make(BDaemonSession bDaemonSession, DaemonSessionTaskListener daemonSessionTaskListener) throws Exception {
BRemoteDaemonPlatform bRemoteDaemonPlatform = BRemoteDaemonPlatform.make(bDaemonSession, daemonSessionTaskListener);
return new NiagaraPlatformDaemon(bRemoteDaemonPlatform);
}
public StationManager getStationManager() {
return this.stationManager;
}
public FileManager getFileManager() {
return this.fileManager;
}
public InstallManager getInstallManager() {
return this.installManager;
}
public DaemonSecurityManager getSecurityManager() {
return this.securityManager;
}
public PlatformLicenseManager getLicenseManager() {
return this.licenseManager;
}
public BackupManager getOfflineBackupManager() throws Exception {
return this.backupManager;
}
public void close() throws Exception {
this.daemonSession.close();
}
public BRemoteDaemonPlatform getDaemonPlatform(DaemonSessionTaskListener daemonSessionTaskListener) throws Exception {
if (this.platform == null) {
this.platform = BRemoteDaemonPlatform.make(this.daemonSession, daemonSessionTaskListener);
}
return this.platform;
}
private final /* synthetic */ void this() {
this.platform = null;
}
private NiagaraPlatformDaemon(BHost bHost, int n, BUsernameAndPassword bUsernameAndPassword) throws Exception {
this(bHost, n, null, bUsernameAndPassword);
}
private NiagaraPlatformDaemon(BHost bHost, int n, String[] stringArray, BUsernameAndPassword bUsernameAndPassword) throws Exception {
this.this();
this.daemonSession = BDaemonSession.make(bHost, n, stringArray);
this.daemonSession.setCredentials((BICredentials)bUsernameAndPassword, true);
this.daemonSession.connect();
this.daemonSession.reloadHostProperties();
this.stationManager = PlatformStationManager.make(this.daemonSession);
this.fileManager = PlatformFileManager.make(this.daemonSession);
this.installManager = PlatformInstallManager.make(this.daemonSession);
this.securityManager = PlatformSecurityManager.make(this.daemonSession);
this.backupManager = PlatformBackupManager.make(this.daemonSession, this);
this.licenseManager = NiagaraLicenseManager.make(this.daemonSession);
}
private NiagaraPlatformDaemon(BRemoteDaemonPlatform bRemoteDaemonPlatform) {
this.this();
this.platform = bRemoteDaemonPlatform;
this.daemonSession = bRemoteDaemonPlatform.getDaemonSession();
this.stationManager = PlatformStationManager.make(this.daemonSession);
this.fileManager = PlatformFileManager.make(this.daemonSession);
this.installManager = PlatformInstallManager.make(this.daemonSession);
this.securityManager = PlatformSecurityManager.make(this.daemonSession);
this.backupManager = PlatformBackupManager.make(this.daemonSession, this);
this.licenseManager = NiagaraLicenseManager.make(this.daemonSession);
}
}
@@ -0,0 +1,85 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.file.BIFile
* javax.baja.sys.Sys
*/
package com.tridium.platform.daemon;
import com.tridium.platform.daemon.BDaemonSession;
import java.lang.reflect.Method;
import javax.baja.file.BIFile;
import javax.baja.platform.BStationStatus;
import javax.baja.platform.BackupManager;
import javax.baja.platform.IPlatformOperationListener;
import javax.baja.platform.PlatformDaemon;
import javax.baja.platform.RemoteStation;
import javax.baja.sys.Sys;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class PlatformBackupManager
implements BackupManager {
private PlatformDaemon daemon;
static /* synthetic */ Class class$javax$baja$job$BJob;
static /* synthetic */ Class class$javax$baja$platform$PlatformDaemon;
static /* synthetic */ Class class$java$io$OutputStream;
public static PlatformBackupManager make(BDaemonSession bDaemonSession, PlatformDaemon platformDaemon) {
return new PlatformBackupManager(bDaemonSession, platformDaemon);
}
public void backup(BIFile bIFile, IPlatformOperationListener iPlatformOperationListener) throws Exception {
Class clazz;
Class clazz2;
RemoteStation[] remoteStationArray = this.daemon.getStationManager().getAllStations();
int n = 0;
while (n < remoteStationArray.length) {
if (remoteStationArray[n].getStatus() == BStationStatus.starting || remoteStationArray[n].getStatus() == BStationStatus.stopping || remoteStationArray[n].getStatus() == BStationStatus.unknown) {
throw new IllegalStateException("Cannot make offline backup while a station is running");
}
++n;
}
Class clazz3 = Sys.loadClass((String)"backup", (String)"javax.baja.backup.BBackupService");
Object t = clazz3.newInstance();
Class[] classArray = new Class[4];
Class clazz4 = class$javax$baja$job$BJob;
if (clazz4 == null) {
clazz4 = classArray[0] = (class$javax$baja$job$BJob = PlatformBackupManager.class("[Ljavax.baja.job.BJob;", false));
}
if ((clazz2 = class$javax$baja$platform$PlatformDaemon) == null) {
clazz2 = classArray[1] = (class$javax$baja$platform$PlatformDaemon = PlatformBackupManager.class("[Ljavax.baja.platform.PlatformDaemon;", false));
}
if ((clazz = class$java$io$OutputStream) == null) {
clazz = class$java$io$OutputStream = PlatformBackupManager.class("[Ljava.io.OutputStream;", false);
}
classArray[2] = clazz;
classArray[3] = Boolean.TYPE;
Method method = clazz3.getDeclaredMethod("zip", classArray);
Object[] objectArray = new Object[4];
objectArray[1] = this.daemon;
objectArray[2] = bIFile.getOutputStream();
objectArray[3] = Boolean.TRUE;
method.invoke(t, objectArray);
}
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 PlatformBackupManager(BDaemonSession bDaemonSession, PlatformDaemon platformDaemon) {
this.daemon = platformDaemon;
}
}
@@ -0,0 +1,248 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.file.BDirectory
* javax.baja.file.BFileSpace
* javax.baja.file.BFileSystem
* javax.baja.file.BIFile
* javax.baja.file.BIFileStore
* javax.baja.file.FilePath
* javax.baja.nre.util.Array
* javax.baja.security.AuthenticationException
* javax.baja.util.Lexicon
*/
package com.tridium.platform.daemon;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.DaemonFileUtil;
import com.tridium.platform.daemon.PlatformOperationListener;
import com.tridium.platform.daemon.file.BCacheAccessPolicy;
import com.tridium.platform.daemon.file.BDaemonDirectoryStore;
import com.tridium.platform.daemon.file.BDaemonFileStore;
import com.tridium.platform.daemon.file.BDefaultDaemonFileSpace;
import com.tridium.platform.daemon.file.StoreCache;
import com.tridium.platform.daemon.message.DeleteFileTransferMessageElement;
import com.tridium.platform.daemon.message.FileTransferMessage;
import com.tridium.platform.daemon.task.DaemonSessionTask;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.ConnectException;
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.FilePath;
import javax.baja.nre.util.Array;
import javax.baja.platform.BOverwritePolicy;
import javax.baja.platform.FileManager;
import javax.baja.platform.FileTransferOperation;
import javax.baja.platform.ICancelHint;
import javax.baja.platform.IPlatformOperationListener;
import javax.baja.security.AuthenticationException;
import javax.baja.util.Lexicon;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class PlatformFileManager
implements FileManager {
private static Lexicon lex = Lexicon.make((String)"platform");
private BDaemonSession daemonSession;
static /* synthetic */ Class class$javax$baja$file$BIFileStore;
static /* synthetic */ Class class$javax$baja$file$BIFile;
public static PlatformFileManager make(BDaemonSession bDaemonSession) {
return new PlatformFileManager(bDaemonSession);
}
public BFileSpace getFileSpace() throws ConnectException, AuthenticationException {
return this.daemonSession.getFileSpace();
}
public void transfer(FileTransferOperation fileTransferOperation, IPlatformOperationListener iPlatformOperationListener) throws ConnectException, AuthenticationException, IOException {
StoreCache storeCache = new StoreCache();
switch (fileTransferOperation.operation) {
case 0: {
this.get(fileTransferOperation.source, fileTransferOperation.destinationDir, fileTransferOperation.recurseDirs, fileTransferOperation.overwritePolicy, new PlatformOperationListener(iPlatformOperationListener), storeCache);
break;
}
case 1: {
this.put(fileTransferOperation.source, fileTransferOperation.destinationDir, fileTransferOperation.recurseDirs, fileTransferOperation.overwritePolicy, new PlatformOperationListener(iPlatformOperationListener), storeCache);
break;
}
case 2: {
this.delete(fileTransferOperation.source, new PlatformOperationListener(iPlatformOperationListener));
break;
}
case 3: {
this.rename(fileTransferOperation.source[0], fileTransferOperation.destinationDir.getName(), new PlatformOperationListener(iPlatformOperationListener));
break;
}
default: {
throw new IllegalArgumentException("Invalid transfer operation");
}
}
}
private final void checkCanceled(ICancelHint iCancelHint) {
if (iCancelHint != null && iCancelHint.isCanceled()) {
throw new ICancelHint.CanceledException();
}
}
private final void rename(FilePath filePath, String string, PlatformOperationListener platformOperationListener) throws ConnectException, AuthenticationException {
DaemonFileUtil.transfer(this.daemonSession, FileTransferMessage.makeRename(filePath, string, this.daemonSession.getFileSpace()), null, platformOperationListener);
}
private final void get(FilePath[] filePathArray, FilePath filePath, boolean bl, BOverwritePolicy bOverwritePolicy, PlatformOperationListener platformOperationListener, StoreCache storeCache) throws ConnectException, AuthenticationException, IOException {
BIFileStore bIFileStore;
Class clazz = class$javax$baja$file$BIFileStore;
if (clazz == null) {
clazz = class$javax$baja$file$BIFileStore = PlatformFileManager.class("[Ljavax.baja.file.BIFileStore;", false);
}
Array array = new Array(clazz);
int n = 0;
while (n < filePathArray.length) {
BDefaultDaemonFileSpace bDefaultDaemonFileSpace = this.daemonSession.getFileSpace();
FilePath filePath2 = filePathArray[n];
boolean bl2 = false;
if (bOverwritePolicy == BOverwritePolicy.different) {
bl2 = true;
}
if ((bIFileStore = bDefaultDaemonFileSpace.findStore(storeCache, filePath2, bl, bl2, BCacheAccessPolicy.lazyFetch)) == null) {
throw new FileNotFoundException(filePathArray[n].getBody() + " not found");
}
array.add((Object)bIFileStore);
++n;
}
n = 0;
while (n < array.size()) {
bIFileStore = (BIFileStore)array.get(n);
if (bIFileStore instanceof BDaemonDirectoryStore) {
this.getDir((BDaemonDirectoryStore)bIFileStore, filePath.merge(bIFileStore.getFileName()), bl, bOverwritePolicy, platformOperationListener);
} else if (bIFileStore instanceof BDaemonFileStore) {
this.getFile((BDaemonFileStore)bIFileStore, filePath.merge(bIFileStore.getFileName()), bOverwritePolicy, platformOperationListener);
}
++n;
}
}
private final void getDir(BDaemonDirectoryStore bDaemonDirectoryStore, FilePath filePath, boolean bl, BOverwritePolicy bOverwritePolicy, PlatformOperationListener platformOperationListener) throws ConnectException, AuthenticationException, IOException {
Array array = bDaemonDirectoryStore.getChildren();
int n = 0;
while (n < array.size()) {
BIFileStore bIFileStore = (BIFileStore)array.get(n);
if (array.get(n) instanceof BDaemonFileStore) {
this.getFile((BDaemonFileStore)bIFileStore, filePath.merge(bIFileStore.getFileName()), bOverwritePolicy, platformOperationListener);
} else if (array.get(n) instanceof BDaemonDirectoryStore && bl) {
this.getDir((BDaemonDirectoryStore)bIFileStore, filePath.merge(bIFileStore.getFileName()), true, bOverwritePolicy, platformOperationListener);
}
++n;
}
}
private final void getFile(BDaemonFileStore bDaemonFileStore, FilePath filePath, BOverwritePolicy bOverwritePolicy, PlatformOperationListener platformOperationListener) throws ConnectException, AuthenticationException, IOException {
BIFile bIFile = BFileSystem.INSTANCE.findFile(filePath);
if (bIFile != null && (bOverwritePolicy == BOverwritePolicy.none || bOverwritePolicy == BOverwritePolicy.different && bDaemonFileStore.getCrc() == DaemonFileUtil.getCrc(bIFile))) {
if (platformOperationListener != null) {
DaemonSessionTask daemonSessionTask = new DaemonSessionTask(lex, "DaemonFileStore.copyToLocalHost.title", "DaemonFileStore.copyToLocalHost.notOverwritten", new Object[]{filePath.getBody()});
platformOperationListener.taskStarted(daemonSessionTask);
platformOperationListener.taskFinished(daemonSessionTask);
}
return;
}
bDaemonFileStore.copyToLocalHost(filePath, platformOperationListener);
}
private final void put(FilePath[] filePathArray, FilePath filePath, boolean bl, BOverwritePolicy bOverwritePolicy, PlatformOperationListener platformOperationListener, StoreCache storeCache) throws ConnectException, AuthenticationException, IOException {
this.checkCanceled(platformOperationListener);
Class clazz = class$javax$baja$file$BIFile;
if (clazz == null) {
clazz = class$javax$baja$file$BIFile = PlatformFileManager.class("[Ljavax.baja.file.BIFile;", false);
}
Array array = new Array(clazz);
int n = 0;
while (n < filePathArray.length) {
this.checkCanceled(platformOperationListener);
BIFile bIFile = BFileSystem.INSTANCE.findFile(filePathArray[n]);
if (bIFile == null) {
throw new FileNotFoundException(filePathArray[n].getBody() + " not found");
}
array.add((Object)bIFile);
++n;
}
FileTransferMessage fileTransferMessage = new FileTransferMessage(this.daemonSession.getFileSpace());
int n2 = 0;
while (n2 < array.size()) {
this.checkCanceled(platformOperationListener);
BIFile bIFile = (BIFile)array.get(n2);
if (bIFile instanceof BDirectory) {
this.putDir((BDirectory)bIFile, filePath.merge(bIFile.getFileName()), bl, bOverwritePolicy, storeCache, fileTransferMessage, platformOperationListener);
} else {
this.putFile(bIFile, filePath.merge(bIFile.getFileName()), bl, bOverwritePolicy, storeCache, fileTransferMessage, platformOperationListener);
}
++n2;
}
DaemonFileUtil.transfer(this.daemonSession, fileTransferMessage, platformOperationListener, platformOperationListener);
}
private final void putDir(BDirectory bDirectory, FilePath filePath, boolean bl, BOverwritePolicy bOverwritePolicy, StoreCache storeCache, FileTransferMessage fileTransferMessage, PlatformOperationListener platformOperationListener) throws ConnectException, AuthenticationException, IOException {
this.checkCanceled(platformOperationListener);
BIFile[] bIFileArray = bDirectory.listFiles();
int n = 0;
while (n < bIFileArray.length) {
this.checkCanceled(platformOperationListener);
if (bIFileArray[n] instanceof BDirectory) {
if (bl) {
this.putDir((BDirectory)bIFileArray[n], filePath.merge(bIFileArray[n].getFileName()), true, bOverwritePolicy, storeCache, fileTransferMessage, platformOperationListener);
}
} else {
this.putFile(bIFileArray[n], filePath.merge(bIFileArray[n].getFileName()), bl, bOverwritePolicy, storeCache, fileTransferMessage, platformOperationListener);
}
++n;
}
}
private final void putFile(BIFile bIFile, FilePath filePath, boolean bl, BOverwritePolicy bOverwritePolicy, StoreCache storeCache, FileTransferMessage fileTransferMessage, PlatformOperationListener platformOperationListener) throws ConnectException, AuthenticationException, IOException {
BDaemonFileStore bDaemonFileStore;
this.checkCanceled(platformOperationListener);
BDefaultDaemonFileSpace bDefaultDaemonFileSpace = this.daemonSession.getFileSpace();
boolean bl2 = false;
if (bOverwritePolicy == BOverwritePolicy.different) {
bl2 = true;
}
if ((bDaemonFileStore = (BDaemonFileStore)bDefaultDaemonFileSpace.findStore(storeCache, filePath, bl, bl2, BCacheAccessPolicy.lazyFetch)) == null || bOverwritePolicy == BOverwritePolicy.different && bDaemonFileStore.getCrc() != DaemonFileUtil.getCrc(bIFile) || bOverwritePolicy == BOverwritePolicy.all) {
fileTransferMessage.addFile(bIFile, filePath);
}
}
private final void delete(FilePath[] filePathArray, PlatformOperationListener platformOperationListener) throws ConnectException, AuthenticationException, IOException {
FileTransferMessage fileTransferMessage = new FileTransferMessage(this.daemonSession.getFileSpace());
int n = 0;
while (n < filePathArray.length) {
fileTransferMessage.addElement(new DeleteFileTransferMessageElement(filePathArray[n], this.daemonSession.getFileSpace()));
++n;
}
DaemonFileUtil.transfer(this.daemonSession, fileTransferMessage, platformOperationListener, platformOperationListener);
}
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 PlatformFileManager(BDaemonSession bDaemonSession) {
this.daemonSession = bDaemonSession;
}
}
@@ -0,0 +1,371 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.file.BIFile
* javax.baja.nre.util.Array
* javax.baja.sys.LocalizableRuntimeException
* javax.baja.sys.SlotCursor
* javax.baja.util.Lexicon
* javax.baja.util.Version
*/
package com.tridium.platform.daemon;
import com.tridium.install.BDaemonPlatform;
import com.tridium.install.BDependency;
import com.tridium.install.BRemoteDaemonPlatform;
import com.tridium.install.BVersion;
import com.tridium.install.DaemonPlatformUtil;
import com.tridium.install.InstallScenario;
import com.tridium.install.UnmeetableDependency;
import com.tridium.install.installable.BInstallable;
import com.tridium.install.installable.BModuleInstallable;
import com.tridium.install.installable.InstallableRegistry;
import com.tridium.install.installable.LocalInstallableRegistry;
import com.tridium.install.part.BModulePart;
import com.tridium.install.part.BNrePart;
import com.tridium.install.part.BPart;
import com.tridium.platform.daemon.BAppSurrogate;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.BStationSurrogate;
import com.tridium.platform.daemon.PlatformInstallOperation;
import com.tridium.platform.daemon.PlatformOperationListener;
import com.tridium.platform.daemon.message.OSUpdateMessage;
import com.tridium.platform.daemon.message.RefreshDaemonBinariesMessage;
import com.tridium.platform.daemon.task.DaemonSessionTaskListener;
import com.tridium.platform.tcpip.TcpUtil;
import java.util.Iterator;
import javax.baja.file.BIFile;
import javax.baja.nre.util.Array;
import javax.baja.platform.BStationStatus;
import javax.baja.platform.ICancelHint;
import javax.baja.platform.IPlatformOperationListener;
import javax.baja.platform.InstallManager;
import javax.baja.platform.InstallOperation;
import javax.baja.platform.install.InstallationSummary;
import javax.baja.platform.install.PlatformDependency;
import javax.baja.platform.install.PlatformPart;
import javax.baja.sys.LocalizableRuntimeException;
import javax.baja.sys.SlotCursor;
import javax.baja.util.Lexicon;
import javax.baja.util.Version;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class PlatformInstallManager
implements InstallManager {
private BDaemonSession daemonSession;
static /* synthetic */ Class class$javax$baja$platform$install$PlatformPart;
static /* synthetic */ Class class$com$tridium$platform$daemon$BAppSurrogate;
public static PlatformInstallManager make(BDaemonSession bDaemonSession) {
return new PlatformInstallManager(bDaemonSession);
}
public PlatformPart[] getPlatformParts(IPlatformOperationListener iPlatformOperationListener) throws Exception {
PlatformOperationListener platformOperationListener = new PlatformOperationListener(iPlatformOperationListener);
Class clazz = class$javax$baja$platform$install$PlatformPart;
if (clazz == null) {
clazz = class$javax$baja$platform$install$PlatformPart = PlatformInstallManager.class("[Ljavax.baja.platform.install.PlatformPart;", false);
}
Array array = new Array(clazz);
BRemoteDaemonPlatform bRemoteDaemonPlatform = BRemoteDaemonPlatform.make(this.daemonSession, platformOperationListener);
bRemoteDaemonPlatform.checkSession(platformOperationListener);
if (!bRemoteDaemonPlatform.getArchPart().isNull()) {
array.add((Object)bRemoteDaemonPlatform.getArchPart().asPlatformPart());
}
if (!bRemoteDaemonPlatform.getOsPart().isNull()) {
array.add((Object)bRemoteDaemonPlatform.getOsPart().asPlatformPart());
}
if (!bRemoteDaemonPlatform.getNrePart().isNull()) {
array.add((Object)bRemoteDaemonPlatform.getNrePart().asPlatformPart());
}
if (!bRemoteDaemonPlatform.getBrandPart().isNull()) {
array.add((Object)bRemoteDaemonPlatform.getBrandPart().asPlatformPart());
}
if (!bRemoteDaemonPlatform.getVmPart().isNull()) {
array.add((Object)bRemoteDaemonPlatform.getVmPart().asPlatformPart());
}
if (!bRemoteDaemonPlatform.getModelPart().isNull()) {
array.add((Object)bRemoteDaemonPlatform.getModelPart().asPlatformPart());
}
SlotCursor slotCursor = bRemoteDaemonPlatform.getOtherParts().getProperties();
while (slotCursor.next()) {
array.add((Object)((BPart)slotCursor.get()).asPlatformPart());
}
bRemoteDaemonPlatform.getModuleList().init(platformOperationListener);
slotCursor = bRemoteDaemonPlatform.getModuleList().getModules().getProperties();
while (slotCursor.next()) {
array.add((Object)((BModuleInstallable)slotCursor.get()).getModulePart().asPlatformPart());
}
return (PlatformPart[])array.trim();
}
public InstallationSummary checkInstall(InstallOperation installOperation, IPlatformOperationListener iPlatformOperationListener) throws Exception {
PlatformInstallOperation platformInstallOperation = (PlatformInstallOperation)installOperation;
PlatformOperationListener platformOperationListener = new PlatformOperationListener(iPlatformOperationListener);
this.checkCanceled(platformOperationListener);
BRemoteDaemonPlatform bRemoteDaemonPlatform = BRemoteDaemonPlatform.make(this.daemonSession, platformOperationListener);
BDependency[] bDependencyArray = new BDependency[platformInstallOperation.installModuleVersions.size()];
int n = 0;
Iterator iterator = platformInstallOperation.installModuleVersions.keySet().iterator();
while (iterator.hasNext()) {
String string = (String)iterator.next();
Version version = (Version)platformInstallOperation.installModuleVersions.get(string);
if (version.equals((Object)Version.NULL)) {
bDependencyArray[n] = BDependency.forModule(string);
BInstallable bInstallable = LocalInstallableRegistry.getInstance().findInstallable(bDependencyArray[n], platformOperationListener);
if (bInstallable != null) {
bDependencyArray[n] = BDependency.forPart(bInstallable.getPart());
}
} else {
bDependencyArray[n] = new BDependency(string, new BVersion(version.toString()), BModulePart.TYPE.getTypeSpec());
}
++n;
}
this.checkCanceled(platformOperationListener);
iPlatformOperationListener.notifyStatus(Lexicon.make((String)"platform").getText("PlatformInstallManager.checkingDependencies"));
return new InstallSummaryImpl(InstallScenario.solve((BDaemonPlatform)bRemoteDaemonPlatform, platformOperationListener, (String[])platformInstallOperation.uninstallModuleNames.trim(), bDependencyArray, (BInstallable[])platformInstallOperation.installDists.trim(), (InstallableRegistry)LocalInstallableRegistry.getInstance()));
}
public void registerInstallableFile(BIFile bIFile, IPlatformOperationListener iPlatformOperationListener) throws Exception {
BInstallable bInstallable = BInstallable.make(bIFile);
if (bInstallable == null) {
throw new LocalizableRuntimeException("platform", "PlatformInstallManager.fileNotInstallable", new Object[]{bIFile.getFilePath().getBody()});
}
LocalInstallableRegistry.getInstance().register(bInstallable, new PlatformOperationListener(iPlatformOperationListener));
}
public void install(InstallOperation installOperation, IPlatformOperationListener iPlatformOperationListener) throws Exception {
BStationStatus bStationStatus;
int n;
BAppSurrogate[] bAppSurrogateArray;
boolean bl;
BInstallable[] bInstallableArray;
UnmeetableDependency[] unmeetableDependencyArray;
PlatformInstallOperation platformInstallOperation = (PlatformInstallOperation)installOperation;
PlatformOperationListener platformOperationListener = new PlatformOperationListener(iPlatformOperationListener);
this.checkCanceled(platformOperationListener);
BRemoteDaemonPlatform bRemoteDaemonPlatform = BRemoteDaemonPlatform.make(this.daemonSession, platformOperationListener);
BDependency[] bDependencyArray = new BDependency[platformInstallOperation.installModuleVersions.size()];
int n2 = 0;
Object object = platformInstallOperation.installModuleVersions.keySet().iterator();
while (object.hasNext()) {
unmeetableDependencyArray = (UnmeetableDependency[])object.next();
bInstallableArray = (BInstallable[])platformInstallOperation.installModuleVersions.get(unmeetableDependencyArray);
if (bInstallableArray.equals((Object)Version.NULL)) {
bDependencyArray[n2] = BDependency.forModule((String)unmeetableDependencyArray);
BInstallable bInstallable = LocalInstallableRegistry.getInstance().findInstallable(bDependencyArray[n2], platformOperationListener);
if (bInstallable != null) {
bDependencyArray[n2] = BDependency.forPart(bInstallable.getPart());
}
} else {
bDependencyArray[n2] = new BDependency((String)unmeetableDependencyArray, new BVersion(bInstallableArray.toString()), BModulePart.TYPE.getTypeSpec());
}
++n2;
}
this.checkCanceled(platformOperationListener);
iPlatformOperationListener.notifyStatus(Lexicon.make((String)"platform").getText("PlatformInstallManager.checkingDependencies"));
object = InstallScenario.solve((BDaemonPlatform)bRemoteDaemonPlatform, platformOperationListener, (String[])platformInstallOperation.uninstallModuleNames.trim(), bDependencyArray, (BInstallable[])platformInstallOperation.installDists.trim(), (InstallableRegistry)LocalInstallableRegistry.getInstance());
unmeetableDependencyArray = ((InstallScenario)object).getUnmeetableDependencies();
if (unmeetableDependencyArray.length > 0) {
throw new LocalizableRuntimeException("platform", "PlatformInstallManager.unmetDependencies", new Object[]{unmeetableDependencyArray[0]});
}
bInstallableArray = ((InstallScenario)object).getExcludedInstallables();
if (bInstallableArray.length > 0) {
throw new LocalizableRuntimeException("platform", "PlatformInstallManager.excludedInstallables", new Object[]{bInstallableArray[0].getInstallableFileName()});
}
this.checkCanceled(platformOperationListener);
long l = ((InstallScenario)object).getProcessingFlags();
boolean bl2 = false;
if (!platformInstallOperation.ignoreTcpIpChanges && (l & 0x80000L) > 0L) {
bl2 = bl = true;
}
if (((InstallScenario)object).getTcpIpChanges() != null && ((InstallScenario)object).getTcpIpChanges().getIsReadonly()) {
bl = false;
}
if (!this.daemonSession.getHostProperties().hasFullAccess() && (bl || (l & 0x30000L) > 0L)) {
throw new LocalizableRuntimeException("platform", "PlatformInstallManager.insufficientAccess");
}
Class clazz = class$com$tridium$platform$daemon$BAppSurrogate;
if (clazz == null) {
clazz = class$com$tridium$platform$daemon$BAppSurrogate = PlatformInstallManager.class("[Lcom.tridium.platform.daemon.BAppSurrogate;", false);
}
Array array = new Array(clazz);
if ((l & (long)4) > 0L && (l & 1L) == 0L && (l & (long)2) == 0L) {
bAppSurrogateArray = BAppSurrogate.makeAll(null, this.daemonSession);
n = 0;
while (n < bAppSurrogateArray.length) {
bStationStatus = bAppSurrogateArray[n].getAppStatus();
if (bAppSurrogateArray[n] instanceof BStationSurrogate && (bStationStatus == BStationStatus.starting || bStationStatus == BStationStatus.stopping)) {
l |= (long)2;
break;
}
++n;
}
}
if ((l & 1L) > 0L || (l & (long)2) > 0L || (l & (long)4) > 0L) {
bAppSurrogateArray = BAppSurrogate.makeAll(null, this.daemonSession);
n = 0;
while (n < bAppSurrogateArray.length) {
bStationStatus = bAppSurrogateArray[n].getAppStatus();
if (!(bStationStatus != BStationStatus.starting && bStationStatus != BStationStatus.running && bStationStatus != BStationStatus.stopping || (l & 1L) <= 0L && !(bAppSurrogateArray[n] instanceof BStationSurrogate))) {
array.add((Object)bAppSurrogateArray[n]);
}
++n;
}
}
if ((l & 1L) > 0L || (l & (long)2) > 0L) {
bAppSurrogateArray = BAppSurrogate.stopAllApps(this.daemonSession, (l & 1L) > 0L ? null : BStationSurrogate.TYPE, platformOperationListener, platformOperationListener);
BStationSurrogate[] bStationSurrogateArray = BStationSurrogate.makeAll(this.daemonSession);
int n3 = 0;
block3: while (n3 < bStationSurrogateArray.length) {
if (bStationSurrogateArray[n3].getStationStatus() != BStationStatus.idle) {
BInstallable[] bInstallableArray2 = ((InstallScenario)object).getToInstall();
int n4 = 0;
while (n4 < bInstallableArray2.length) {
BPart bPart = bInstallableArray2[n4].getPart();
if (bPart != null && bPart instanceof BNrePart) {
DaemonPlatformUtil.doExtraStationShutdownTasks(bRemoteDaemonPlatform, platformOperationListener, platformOperationListener);
break block3;
}
++n4;
}
break;
}
++n3;
}
if (bAppSurrogateArray.length > 0) {
n3 = 0;
while (n3 < bAppSurrogateArray.length) {
iPlatformOperationListener.notifyStatus(Lexicon.make((String)"platform").getText("PlatformInstallManager.stoppedApp", new Object[]{bAppSurrogateArray[n3].getAppName()}));
++n3;
}
}
} else {
bAppSurrogateArray = (BAppSurrogate[])array.trim();
}
this.checkCanceled(platformOperationListener);
iPlatformOperationListener.notifyStatus(Lexicon.make((String)"platform").getText("PlatformInstallManager.committing"));
((InstallScenario)object).commit((DaemonSessionTaskListener)platformOperationListener, platformOperationListener, platformInstallOperation.ignoreAuthChanges);
if (bl) {
iPlatformOperationListener.notifyStatus(Lexicon.make((String)"platform").getText("PlatformInstallManager.tcpInstall"));
TcpUtil.saveToSession(((InstallScenario)object).getTcpIpChanges(), this.daemonSession, false);
}
if ((l & 0x20000L) > 0L) {
iPlatformOperationListener.notifyStatus(Lexicon.make((String)"platform").getText("PlatformInstallManager.osInstall"));
this.daemonSession.sendMessage(OSUpdateMessage.getInstance(), 60000);
}
if ((l & 0x10000L) > 0L) {
iPlatformOperationListener.notifyStatus(Lexicon.make((String)"platform").getText("PlatformInstallManager.reboot"));
this.daemonSession.sendRebootRequest();
} else if ((l & 0x40000L) > 0L) {
iPlatformOperationListener.notifyStatus(Lexicon.make((String)"platform").getText("PlatformInstallManager.updateDaemon"));
this.daemonSession.sendMessage(RefreshDaemonBinariesMessage.getInstance());
} else if ((l & (long)4) > 0L && (l & (long)2) == 0L && (l & 1L) == 0L) {
int n5 = 0;
while (n5 < bAppSurrogateArray.length) {
if (bAppSurrogateArray[n5] instanceof BStationSurrogate) {
((BStationSurrogate)bAppSurrogateArray[n5]).syncStationModulesAsync();
}
++n5;
}
}
iPlatformOperationListener.notifyStatus(Lexicon.make((String)"platform").getText("PlatformInstallManager.success"));
}
private final void checkCanceled(PlatformOperationListener platformOperationListener) {
if (platformOperationListener.isCanceled()) {
throw new ICancelHint.CanceledException();
}
}
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 PlatformInstallManager(BDaemonSession bDaemonSession) {
this.daemonSession = bDaemonSession;
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
private static class InstallSummaryImpl
implements InstallationSummary {
private InstallScenario scenario;
static /* synthetic */ Class class$javax$baja$file$BIFile;
public BIFile[] getFilesToInstall() {
Class clazz = class$javax$baja$file$BIFile;
if (clazz == null) {
clazz = class$javax$baja$file$BIFile = InstallSummaryImpl.class("[Ljavax.baja.file.BIFile;", false);
}
Array array = new Array(clazz);
int n = 0;
while (n < this.scenario.getToInstall().length) {
array.add((Object)((BIFile)this.scenario.getToInstall()[n].getInstallableFileOrd().get()));
++n;
}
return (BIFile[])array.trim();
}
public String[] getModulesToUninstall() {
return this.scenario.getModulesToUninstall();
}
public PlatformDependency[] getUnmetDependencies() {
UnmeetableDependency[] unmeetableDependencyArray = this.scenario.getUnmeetableDependencies();
PlatformDependency[] platformDependencyArray = new PlatformDependency[unmeetableDependencyArray.length];
int n = 0;
while (n < unmeetableDependencyArray.length) {
platformDependencyArray[n] = unmeetableDependencyArray[n].dependency.asPlatformDependency();
++n;
}
return platformDependencyArray;
}
public BIFile[] getExcludedFiles() {
BInstallable[] bInstallableArray = this.scenario.getExcludedInstallables();
BIFile[] bIFileArray = new BIFile[bInstallableArray.length];
int n = 0;
while (n < bInstallableArray.length) {
bIFileArray[n] = (BIFile)bInstallableArray[n].getInstallableFileOrd().get();
++n;
}
return bIFileArray;
}
public boolean canInstall() {
return this.scenario.canCommit();
}
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 InstallSummaryImpl(InstallScenario installScenario) {
this.scenario = installScenario;
}
}
}
@@ -0,0 +1,118 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.file.BIFile
* javax.baja.nre.util.Array
* javax.baja.sys.BajaRuntimeException
* javax.baja.sys.LocalizableRuntimeException
* javax.baja.util.Version
*/
package com.tridium.platform.daemon;
import com.tridium.install.installable.BDistribution;
import com.tridium.install.installable.BInstallable;
import com.tridium.install.installable.LocalInstallableRegistry;
import java.util.HashMap;
import java.util.Map;
import javax.baja.file.BIFile;
import javax.baja.nre.util.Array;
import javax.baja.platform.InstallOperation;
import javax.baja.sys.BajaRuntimeException;
import javax.baja.sys.LocalizableRuntimeException;
import javax.baja.util.Version;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class PlatformInstallOperation
extends InstallOperation {
Map installModuleVersions;
Array installDists;
Array uninstallModuleNames;
boolean ignoreTcpIpChanges;
boolean ignoreAuthChanges;
static /* synthetic */ Class class$com$tridium$install$installable$BDistribution;
static /* synthetic */ Class class$java$lang$String;
public void setIgnoreTcpIpChanges(boolean bl) {
this.ignoreTcpIpChanges = bl;
}
public void setIgnoreAuthChanges(boolean bl) {
this.ignoreAuthChanges = bl;
}
public void installModule(String string, Version version) {
if (version == null) {
this.installModuleVersions.put(string, Version.NULL);
} else {
this.installModuleVersions.put(string, version);
}
}
public void installDistribution(BIFile bIFile) throws Exception {
if (!"dist".equals(bIFile.getExtension())) {
throw new LocalizableRuntimeException("platform", "PlatformInstallManager.notDistFile", new Object[]{bIFile.getFilePath().getBody()});
}
BDistribution bDistribution = new BDistribution(bIFile);
this.installDists.add((Object)bDistribution);
}
public void installDistribution(String string, Version version) {
if (version == null) {
version = Version.NULL;
}
try {
BInstallable bInstallable = LocalInstallableRegistry.getInstance().findInstallable(string, version, BDistribution.TYPE, null);
if (bInstallable == null) {
throw new LocalizableRuntimeException("platform", "PlatformInstallManager.softwareNotFound", new Object[]{string, version});
}
this.installDists.add((Object)bInstallable);
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public void uninstallModule(String string) {
this.uninstallModuleNames.add((Object)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.ignoreTcpIpChanges = false;
this.ignoreAuthChanges = false;
}
public PlatformInstallOperation() {
this.this();
this.installModuleVersions = new HashMap();
Class clazz = class$com$tridium$install$installable$BDistribution;
if (clazz == null) {
clazz = class$com$tridium$install$installable$BDistribution = PlatformInstallOperation.class("[Lcom.tridium.install.installable.BDistribution;", false);
}
this.installDists = new Array(clazz);
Class clazz2 = class$java$lang$String;
if (clazz2 == null) {
clazz2 = class$java$lang$String = PlatformInstallOperation.class("[Ljava.lang.String;", false);
}
this.uninstallModuleNames = new Array(clazz2);
}
}
@@ -0,0 +1,65 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platform.daemon;
import com.tridium.platform.daemon.task.DaemonSessionTask;
import com.tridium.platform.daemon.task.DaemonSessionTaskListener;
import javax.baja.platform.ICancelHint;
import javax.baja.platform.IPlatformOperationListener;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class PlatformOperationListener
implements DaemonSessionTaskListener,
ICancelHint {
private IPlatformOperationListener listener;
private String lastStatus;
public void taskStarted(DaemonSessionTask daemonSessionTask) {
this.taskUpdated(daemonSessionTask);
}
public void taskUpdated(DaemonSessionTask daemonSessionTask) {
if (this.listener == null) {
return;
}
String string = daemonSessionTask.getMessage();
if (string.equals(this.lastStatus)) {
return;
}
this.lastStatus = string;
this.listener.notifyStatus(string);
}
public void taskFinished(DaemonSessionTask daemonSessionTask) {
this.taskUpdated(daemonSessionTask);
}
public boolean isCancelEnabled() {
boolean bl = false;
if (this.listener != null) {
bl = true;
}
return bl;
}
public boolean isCanceled() {
boolean bl = false;
if (this.listener != null && this.listener.isCanceled()) {
bl = true;
}
return bl;
}
private final /* synthetic */ void this() {
this.lastStatus = null;
}
public PlatformOperationListener(IPlatformOperationListener iPlatformOperationListener) {
this.this();
this.listener = iPlatformOperationListener;
}
}
@@ -0,0 +1,181 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.net.HttpUtil
* com.tridium.nre.auth.SecurityUtil
* javax.baja.security.BPassword
* javax.baja.sys.BajaRuntimeException
* javax.baja.user.BPasswordStrength
* javax.baja.xml.XElem
* javax.baja.xml.XParser
*/
package com.tridium.platform.daemon;
import com.tridium.net.HttpUtil;
import com.tridium.nre.auth.SecurityUtil;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.message.DaemonMessage;
import com.tridium.platform.daemon.message.SystemPasswordMessageAX;
import com.tridium.platform.daemon.message.XmlResponseMessage;
import java.io.InputStream;
import javax.baja.platform.DaemonSecurityManager;
import javax.baja.security.BPassword;
import javax.baja.sys.BajaRuntimeException;
import javax.baja.user.BPasswordStrength;
import javax.baja.xml.XElem;
import javax.baja.xml.XParser;
public class PlatformSecurityManager
implements DaemonSecurityManager {
private BDaemonSession daemonSession;
public static PlatformSecurityManager make(BDaemonSession bDaemonSession) {
return new PlatformSecurityManager(bDaemonSession);
}
public void useSingleAdminAccount(String string, String string2) throws Exception {
DigestFileAuthMessage digestFileAuthMessage = new DigestFileAuthMessage(string, BPassword.make((String)string2));
if (!this.daemonSession.sendMessage(digestFileAuthMessage)) {
throw new RuntimeException(digestFileAuthMessage.getErrorMessage());
}
Thread.sleep(3000L);
}
public void useOsGroups(String string, String string2) throws Exception {
XElem xElem = null;
XElem xElem2 = null;
try {
xElem = XParser.make((InputStream)this.daemonSession.getInputStream((DaemonMessage)new XmlResponseMessage(){
public final String getMessageString() {
return "auth";
}
}, "text/xml")).parse();
xElem2 = xElem.elem("auth");
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
if (!xElem2.getb("nativeAuthSupported", this.daemonSession.getHostProperties().getOsName().startsWith("win"))) {
throw new UnsupportedOperationException("OS group-based authentication is not available for this platform");
}
BasicNativeAuthMessage basicNativeAuthMessage = new BasicNativeAuthMessage(string, string2);
if (!this.daemonSession.sendMessage(basicNativeAuthMessage)) {
throw new RuntimeException(basicNativeAuthMessage.getErrorMessage());
}
Thread.sleep(3000L);
}
public void updateSystemPassphrase(char[] cArray, char[] cArray2) throws Exception {
if (!this.daemonSession.getHostProperties().supportsServlet("systempwax")) {
throw new UnsupportedOperationException("updateSystemPassphrase is unsupported for this host");
}
if (cArray == null) {
throw new IllegalArgumentException("Passphrase can not be null");
}
this.validatePassword(new String(cArray2));
if (SecurityUtil.equals((char[])cArray, (char[])cArray2)) {
throw new IllegalArgumentException("Passphrase values are not different");
}
try {
if (!this.daemonSession.sendMessage(new SystemPasswordMessageAX(BPassword.make((char[])cArray2, (String)"aes256/text"), BPassword.make((char[])cArray, (String)"aes256/text"), true))) {
throw new BajaRuntimeException("Error checking system passphrase");
}
if (!this.daemonSession.sendMessage(new SystemPasswordMessageAX(BPassword.make((char[])cArray2, (String)"aes256/text"), BPassword.make((char[])cArray, (String)"aes256/text"), false))) {
throw new BajaRuntimeException("Error setting system passphrase");
}
}
catch (Exception exception) {}
}
private final void validatePassword(String string) throws IllegalArgumentException {
StringBuffer stringBuffer = new StringBuffer();
if (!PlatformSecurityManager.isValidPlatformPassword(string, stringBuffer)) {
throw new IllegalArgumentException("Passphrase invalid: " + stringBuffer.toString());
}
}
public static boolean isValidPlatformPassword(String string, StringBuffer stringBuffer) {
if (string == null) {
stringBuffer.append("Password cannot be null");
return false;
}
int n = 0;
while (n < string.length()) {
char c = string.charAt(n);
if (c < '!' || c > '~') {
stringBuffer.append("Invalid password character \"").append(c).append("\"");
return false;
}
++n;
}
if (string.length() > 64) {
stringBuffer.append("Password can not exceed 64 characters");
return false;
}
try {
BPasswordStrength.STRONG.isPasswordValid(string);
}
catch (Exception exception) {
stringBuffer.append(exception);
return false;
}
return true;
}
private PlatformSecurityManager(BDaemonSession bDaemonSession) {
this.daemonSession = bDaemonSession;
}
private static class DigestFileAuthMessage
extends XmlResponseMessage {
private StringBuffer buf = new StringBuffer("auth?update=true&authtype=");
public String getMessageString() {
return this.buf.toString();
}
public int getConnectionFlags() {
return 16;
}
public DigestFileAuthMessage(String string, BPassword bPassword) {
this.buf.append(HttpUtil.encodeUrl((String)"digest/file"));
this.buf.append("&user=");
this.buf.append(HttpUtil.encodeUrl((String)string));
this.buf.append("&password=");
try {
this.buf.append(HttpUtil.encodeUrl((String)bPassword.encodeToString()));
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
private class BasicNativeAuthMessage
extends XmlResponseMessage {
private StringBuffer buf = new StringBuffer("auth?update=true&authtype=");
public String getMessageString() {
return this.buf.toString();
}
public int getConnectionFlags() {
return 16;
}
public BasicNativeAuthMessage(String string, String string2) {
this.buf.append(HttpUtil.encodeUrl((String)"basic/native"));
this.buf.append("&usergroup=");
this.buf.append(HttpUtil.encodeUrl((String)string));
this.buf.append("&admingroup=");
this.buf.append(HttpUtil.encodeUrl((String)string2));
}
}
}
@@ -0,0 +1,143 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.file.BDirectory
* javax.baja.file.BIFile
* javax.baja.file.FilePath
* javax.baja.nre.util.TextUtil
* javax.baja.security.AuthenticationException
* javax.baja.sys.BajaRuntimeException
* javax.baja.util.Lexicon
*/
package com.tridium.platform.daemon;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.DaemonFileUtil;
import com.tridium.platform.daemon.PlatformOperationListener;
import com.tridium.platform.daemon.RemotePlatformStation;
import com.tridium.platform.daemon.message.FileTransferMessage;
import com.tridium.platform.daemon.message.UpdateStationMessage;
import java.net.ConnectException;
import java.net.SocketException;
import javax.baja.file.BDirectory;
import javax.baja.file.BIFile;
import javax.baja.file.FilePath;
import javax.baja.nre.util.TextUtil;
import javax.baja.platform.IPlatformOperationListener;
import javax.baja.platform.RemoteStation;
import javax.baja.platform.StationManager;
import javax.baja.security.AuthenticationException;
import javax.baja.sys.BajaRuntimeException;
import javax.baja.util.Lexicon;
public class PlatformStationManager
implements StationManager {
private static final Lexicon lex = Lexicon.make((String)"platform");
private BDaemonSession daemonSession;
public static PlatformStationManager make(BDaemonSession bDaemonSession) {
return new PlatformStationManager(bDaemonSession);
}
public RemoteStation createStation(BDirectory bDirectory, String string, IPlatformOperationListener iPlatformOperationListener) throws Exception {
PlatformOperationListener platformOperationListener = new PlatformOperationListener(iPlatformOperationListener);
RemoteStation[] remoteStationArray = this.getAllStations();
int n = remoteStationArray.length + 1;
RemoteStation remoteStation = null;
int n2 = 0;
while (n2 < remoteStationArray.length) {
if (TextUtil.toLowerCase((String)remoteStationArray[n2].getName()).equals(TextUtil.toLowerCase((String)string))) {
remoteStation = remoteStationArray[n2];
--n;
break;
}
++n2;
}
if (n > this.daemonSession.getHostProperties().getMaxStations()) {
throw new BajaRuntimeException("Maximum number of stations exceeded");
}
if (remoteStation != null) {
remoteStation.stop(iPlatformOperationListener);
}
FileTransferMessage fileTransferMessage = new FileTransferMessage(this.daemonSession.getFileSpace());
this.addDir(fileTransferMessage, bDirectory, new FilePath("!stations/" + string));
DaemonFileUtil.transfer(this.daemonSession, fileTransferMessage, platformOperationListener, platformOperationListener);
if (remoteStation == null) {
this.daemonSession.sendMessage(new UpdateStationMessage());
this.daemonSession.sendMessage(new UpdateStationMessage(string, false, true, true, true));
remoteStation = this.getStation(string);
} else {
remoteStation.poll();
}
return remoteStation;
}
public RemoteStation[] getAllStations() throws Exception {
return RemotePlatformStation.getAllStations(this.daemonSession);
}
public RemoteStation getStation(String string) throws Exception {
return RemotePlatformStation.getStation(this.daemonSession, string);
}
public RemoteStation[] stopAllStations(IPlatformOperationListener iPlatformOperationListener) throws Exception {
return RemotePlatformStation.stopAllStations(this.daemonSession, iPlatformOperationListener);
}
public void rebootAsync() throws ConnectException, AuthenticationException {
this.daemonSession.sendRebootRequest(false);
}
public void rebootSync(IPlatformOperationListener iPlatformOperationListener) throws Exception {
String string = this.daemonSession.getHostProperties().getSessionTimestamp();
String string2 = this.daemonSession.getHost().getNavDisplayName(null);
iPlatformOperationListener.notifyStatus(lex.getText("RemotePlatformStation.reboot", new Object[]{string2}));
this.daemonSession.sendRebootRequest(false);
iPlatformOperationListener.notifyStatus(lex.getText("RemotePlatformStation.reconnecting", new Object[]{string2}));
while (!iPlatformOperationListener.isCanceled()) {
try {
this.daemonSession.reloadHostProperties(15000);
if (this.daemonSession.getHostProperties().getSessionTimestamp().equals(string)) continue;
iPlatformOperationListener.notifyStatus(lex.getText("RemotePlatformStation.reconnected", new Object[]{string2}));
break;
}
catch (SocketException socketException) {}
}
}
private final void addDir(FileTransferMessage fileTransferMessage, BDirectory bDirectory, FilePath filePath) throws Exception {
BIFile[] bIFileArray = bDirectory.listFiles();
int n = 0;
while (n < bIFileArray.length) {
if (bIFileArray[n] instanceof BDirectory) {
this.addDir(fileTransferMessage, (BDirectory)bIFileArray[n], filePath.merge(bIFileArray[n].getFileName()));
} else if (!this.ignoreStationFile(bIFileArray[n])) {
fileTransferMessage.addFile(bIFileArray[n], filePath.merge(bIFileArray[n].getFileName()));
}
++n;
}
}
private final boolean ignoreStationFile(BIFile bIFile) {
return this.ignoreStationFile(bIFile.getFileName());
}
private final boolean ignoreStationFile(String string) {
if (string.endsWith(".lock")) {
return true;
}
if (string.startsWith("console.")) {
return true;
}
if (string.startsWith("config.bog.b")) {
return true;
}
return string.startsWith("config_backup");
}
private PlatformStationManager(BDaemonSession bDaemonSession) {
this.daemonSession = bDaemonSession;
}
}
@@ -0,0 +1,68 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.net.HttpConnection
*/
package com.tridium.platform.daemon;
import java.io.IOException;
import java.io.OutputStream;
import javax.baja.net.HttpConnection;
import javax.baja.platform.ICancelHint;
class PostOutputStream
extends OutputStream {
private HttpConnection conn;
private OutputStream out;
private ICancelHint cancelHint;
public void close() throws IOException {
this.conn.postComplete();
this.out.close();
this.conn.close();
}
public void flush() throws IOException {
this.out.flush();
}
public void write(int n) throws IOException {
if (PostOutputStream.canceled(this.cancelHint)) {
throw new ICancelHint.CanceledException();
}
this.out.write(n);
}
public void write(byte[] byArray) throws IOException {
if (PostOutputStream.canceled(this.cancelHint)) {
throw new ICancelHint.CanceledException();
}
this.out.write(byArray);
}
public void write(byte[] byArray, int n, int n2) throws IOException {
if (PostOutputStream.canceled(this.cancelHint)) {
throw new ICancelHint.CanceledException();
}
this.out.write(byArray, n, n2);
}
public static boolean canceled(ICancelHint iCancelHint) {
boolean bl = false;
if (iCancelHint != null && iCancelHint.isCanceled()) {
bl = true;
}
return bl;
}
public PostOutputStream(HttpConnection httpConnection, ICancelHint iCancelHint) throws IOException {
if (PostOutputStream.canceled(iCancelHint)) {
throw new ICancelHint.CanceledException();
}
this.conn = httpConnection;
this.out = httpConnection.getOutputStream();
this.cancelHint = iCancelHint;
}
}
@@ -0,0 +1,163 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.file.BDirectory
* javax.baja.file.FilePath
* javax.baja.naming.BOrd
* javax.baja.security.AuthenticationException
* javax.baja.sys.LocalizableRuntimeException
*/
package com.tridium.platform.daemon;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.BStationSurrogate;
import com.tridium.platform.daemon.DaemonFileUtil;
import com.tridium.platform.daemon.PlatformOperationListener;
import com.tridium.platform.daemon.message.FileTransferMessage;
import com.tridium.platform.daemon.message.UpdateStationMessage;
import java.net.ConnectException;
import javax.baja.file.BDirectory;
import javax.baja.file.FilePath;
import javax.baja.naming.BOrd;
import javax.baja.platform.BStationStatus;
import javax.baja.platform.IPlatformOperationListener;
import javax.baja.platform.RemoteStation;
import javax.baja.security.AuthenticationException;
import javax.baja.sys.LocalizableRuntimeException;
public class RemotePlatformStation
implements RemoteStation {
private BStationSurrogate station;
public BStationStatus getStatus() {
return this.station.getStationStatus();
}
public String getName() {
return this.station.getStationName();
}
public BOrd getFoxOrd() {
return this.station.getFoxOrd();
}
public void poll() throws Exception {
this.station.poll();
}
public boolean canStart() throws Exception {
this.poll();
if (this.station.isStationRunning()) {
return false;
}
if (!(this.canRestart() || this.station.getStationStatus() != BStationStatus.halted && this.station.getStationStatus() != BStationStatus.failed)) {
return false;
}
System.out.println("canRestart = " + this.canRestart());
System.out.println("status = " + (Object)((Object)this.station.getStationStatus()));
return true;
}
public void start(IPlatformOperationListener iPlatformOperationListener) throws Exception {
this.poll();
if (!(this.station.isStationRunning() || this.canRestart() || this.station.getStationStatus() != BStationStatus.halted && this.station.getStationStatus() != BStationStatus.failed)) {
throw new LocalizableRuntimeException("platform", "RemotePlatformStation.cannotStartHalted");
}
PlatformOperationListener platformOperationListener = new PlatformOperationListener(iPlatformOperationListener);
this.station.startStation(platformOperationListener, platformOperationListener);
}
public void startAsync() throws Exception {
this.poll();
if (this.station.isStationRunning()) {
throw new LocalizableRuntimeException("platform", "RemotePlatformStation.stationRunning");
}
if (!(this.canRestart() || this.station.getStationStatus() != BStationStatus.halted && this.station.getStationStatus() != BStationStatus.failed)) {
throw new LocalizableRuntimeException("platform", "RemotePlatformStation.cannotStartHalted");
}
this.station.startStationAsync();
}
public void saveAsync() throws ConnectException, AuthenticationException {
this.station.saveStationAsync();
}
public void save(IPlatformOperationListener iPlatformOperationListener) throws ConnectException, AuthenticationException {
PlatformOperationListener platformOperationListener = new PlatformOperationListener(iPlatformOperationListener);
this.station.saveStation(platformOperationListener, platformOperationListener);
}
public void rename(String string, IPlatformOperationListener iPlatformOperationListener) throws Exception {
PlatformOperationListener platformOperationListener = new PlatformOperationListener(iPlatformOperationListener);
BDaemonSession bDaemonSession = this.station.getDaemonSession();
if (this.station.isStationRunning()) {
this.station.stopStation(platformOperationListener, platformOperationListener);
}
DaemonFileUtil.transfer(bDaemonSession, FileTransferMessage.makeRename(new FilePath("!stations/" + this.station.getStationName()), string, bDaemonSession.getFileSpace()), null, platformOperationListener);
bDaemonSession.sendMessage(new UpdateStationMessage());
this.station = BStationSurrogate.make(bDaemonSession, string);
}
public void stopAsync() throws ConnectException, AuthenticationException {
this.station.stopStationAsync();
}
public void stop(IPlatformOperationListener iPlatformOperationListener) throws ConnectException, AuthenticationException {
PlatformOperationListener platformOperationListener = new PlatformOperationListener(iPlatformOperationListener);
this.station.stopStation(platformOperationListener, platformOperationListener);
}
public boolean canRestart() throws Exception {
return this.station.isRestartEnabled();
}
public void restartAsync() throws Exception {
if (!this.canRestart()) {
throw new LocalizableRuntimeException("platform", "RemotePlatformStation.restartNotAllowed");
}
this.station.restartStationAsync();
}
public void killAsync() throws ConnectException, AuthenticationException {
this.station.killStationAsync();
}
public void delete(IPlatformOperationListener iPlatformOperationListener) throws ConnectException, AuthenticationException {
PlatformOperationListener platformOperationListener = new PlatformOperationListener(iPlatformOperationListener);
this.station.deleteStation(platformOperationListener, platformOperationListener);
}
public void makeLocalCopy(BDirectory bDirectory, IPlatformOperationListener iPlatformOperationListener) throws Exception {
PlatformOperationListener platformOperationListener = new PlatformOperationListener(iPlatformOperationListener);
this.station.makeStationCopy(bDirectory, platformOperationListener);
}
private static final RemoteStation[] array(BStationSurrogate[] bStationSurrogateArray) {
RemoteStation[] remoteStationArray = new RemoteStation[bStationSurrogateArray.length];
int n = 0;
while (n < bStationSurrogateArray.length) {
remoteStationArray[n] = new RemotePlatformStation(bStationSurrogateArray[n]);
++n;
}
return remoteStationArray;
}
public static RemoteStation[] getAllStations(BDaemonSession bDaemonSession) throws Exception {
return RemotePlatformStation.array(BStationSurrogate.makeAll(bDaemonSession));
}
public static RemoteStation getStation(BDaemonSession bDaemonSession, String string) throws Exception {
return new RemotePlatformStation(BStationSurrogate.make(bDaemonSession, string));
}
public static RemoteStation[] stopAllStations(BDaemonSession bDaemonSession, IPlatformOperationListener iPlatformOperationListener) throws Exception {
PlatformOperationListener platformOperationListener = new PlatformOperationListener(iPlatformOperationListener);
return RemotePlatformStation.array(BStationSurrogate.stopAllStations(bDaemonSession, platformOperationListener, platformOperationListener));
}
private RemotePlatformStation(BStationSurrogate bStationSurrogate) {
this.station = bStationSurrogate;
}
}
@@ -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 com.tridium.platform.daemon.file;
import javax.baja.sys.BFrozenEnum;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public final class BCacheAccessPolicy
extends BFrozenEnum {
public static final int LAZY_FETCH = 0;
public static final int CACHE_ONLY = 1;
public static final int FORCE_FETCH = 2;
public static final BCacheAccessPolicy lazyFetch = new BCacheAccessPolicy(0);
public static final BCacheAccessPolicy cacheOnly = new BCacheAccessPolicy(1);
public static final BCacheAccessPolicy forceFetch = new BCacheAccessPolicy(2);
public static final Type TYPE;
public static final BCacheAccessPolicy DEFAULT;
static /* synthetic */ Class class$com$tridium$platform$daemon$file$BCacheAccessPolicy;
public final Type getType() {
return TYPE;
}
public static final BCacheAccessPolicy make(int n) {
return (BCacheAccessPolicy)lazyFetch.getRange().get(n, false);
}
public static final BCacheAccessPolicy make(String string) {
return (BCacheAccessPolicy)lazyFetch.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 BCacheAccessPolicy(int n) {
super(n);
}
static {
Class clazz = class$com$tridium$platform$daemon$file$BCacheAccessPolicy;
if (clazz == null) {
clazz = class$com$tridium$platform$daemon$file$BCacheAccessPolicy = BCacheAccessPolicy.class("[Lcom.tridium.platform.daemon.file.BCacheAccessPolicy;", false);
}
TYPE = Sys.loadType((Class)clazz);
DEFAULT = lazyFetch;
}
}
@@ -0,0 +1,289 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.file.BAbstractFileStore
* javax.baja.file.BDirectory
* javax.baja.file.BIFile
* javax.baja.file.BIFileStore
* javax.baja.file.FilePath
* javax.baja.naming.BOrd
* javax.baja.nre.util.Array
* javax.baja.sys.BajaRuntimeException
* javax.baja.sys.Context
* javax.baja.sys.LocalizableRuntimeException
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform.daemon.file;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.DaemonFileUtil;
import com.tridium.platform.daemon.PlatformOperationListener;
import com.tridium.platform.daemon.file.BCacheAccessPolicy;
import com.tridium.platform.daemon.file.BDaemonDirectoryStore;
import com.tridium.platform.daemon.file.BDaemonFileSpace;
import com.tridium.platform.daemon.file.BDaemonFileStore;
import com.tridium.platform.daemon.file.FileHeaderInfo;
import com.tridium.platform.daemon.file.StoreCache;
import com.tridium.platform.daemon.message.FileHeaderMessage;
import com.tridium.platform.daemon.message.FileTransferMessage;
import com.tridium.platform.daemon.task.DaemonSessionTaskListener;
import java.io.IOException;
import javax.baja.file.BAbstractFileStore;
import javax.baja.file.BDirectory;
import javax.baja.file.BIFile;
import javax.baja.file.BIFileStore;
import javax.baja.file.FilePath;
import javax.baja.naming.BOrd;
import javax.baja.nre.util.Array;
import javax.baja.platform.ICancelHint;
import javax.baja.platform.IPlatformOperationListener;
import javax.baja.sys.BajaRuntimeException;
import javax.baja.sys.Context;
import javax.baja.sys.LocalizableRuntimeException;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BCachedDaemonFileSpace
extends BDaemonFileSpace {
public static final Type TYPE;
private BDaemonSession session;
private boolean recurseDirs;
private boolean getCrcs;
private boolean getLocalPaths;
private StoreCache cache;
private ICancelHint cancelHint;
private DaemonSessionTaskListener taskListener;
static /* synthetic */ Class class$com$tridium$platform$daemon$file$BCachedDaemonFileSpace;
public Type getType() {
return TYPE;
}
public BDaemonSession getDaemonSession() {
return this.session;
}
public BDirectory makeDir(FilePath filePath, Context context) throws IOException {
int n = this.cache.getCacheStatus(filePath);
if (n == 1) {
return this.createDir(filePath, context);
}
if (n == 0) {
return new BDirectory(this.cache.getStore(filePath));
}
BDaemonDirectoryStore bDaemonDirectoryStore = BDaemonDirectoryStore.make(this, filePath, this.recurseDirs, this.getCrcs, this.getLocalPaths, this.cache);
if (bDaemonDirectoryStore == null) {
return this.createDir(filePath, context);
}
return new BDirectory((BIFileStore)bDaemonDirectoryStore);
}
private final BDirectory createDir(FilePath filePath, Context context) throws IOException {
this.cache.clear(filePath);
try {
DaemonFileUtil.transfer(this.getDaemonSession(), FileTransferMessage.makeMkDir(filePath, this), this.cancelHint, this.taskListener);
BDaemonDirectoryStore bDaemonDirectoryStore = BDaemonDirectoryStore.make(this, filePath, this.recurseDirs, this.getCrcs, this.getLocalPaths, this.cache);
return bDaemonDirectoryStore == null ? null : new BDirectory((BIFileStore)bDaemonDirectoryStore);
}
catch (IOException iOException) {
throw iOException;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public BIFile makeFile(FilePath filePath, Context context) throws IOException {
throw new LocalizableRuntimeException("platform", "DaemonFileSpace.readonly");
}
public void move(FilePath filePath, FilePath filePath2, Context context) throws IOException {
throw new LocalizableRuntimeException("platform", "DaemonFileSpace.readonly");
}
public void delete(FilePath filePath, Context context) throws IOException {
this.cache.clear(filePath);
try {
DaemonFileUtil.transfer(this.getDaemonSession(), FileTransferMessage.makeDelete(filePath, this), this.cancelHint, this.taskListener);
}
catch (IOException iOException) {
throw iOException;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public BIFile getChild(BIFile bIFile, String string) {
return this.getChild(bIFile, string, BCacheAccessPolicy.lazyFetch);
}
public BIFile[] getChildren(BIFile bIFile) {
return this.getChildren(bIFile, BCacheAccessPolicy.lazyFetch);
}
public BIFile findFile(FilePath filePath) {
return this.findFile(filePath, BCacheAccessPolicy.lazyFetch);
}
public BIFileStore findStore(FilePath filePath) {
return this.findStore(filePath, BCacheAccessPolicy.lazyFetch);
}
public BIFileStore findStore(FilePath filePath, BCacheAccessPolicy bCacheAccessPolicy) {
try {
BAbstractFileStore bAbstractFileStore;
int n = bCacheAccessPolicy == BCacheAccessPolicy.forceFetch ? 2 : this.cache.getCacheStatus(filePath);
if (n == 1) {
return null;
}
if (n == 0) {
return this.cache.getStore(filePath);
}
if (bCacheAccessPolicy == BCacheAccessPolicy.cacheOnly) {
return null;
}
FileHeaderInfo fileHeaderInfo = DaemonFileUtil.getFileHeaderInfo(this.getDaemonSession(), new FileHeaderMessage(filePath, this));
if (fileHeaderInfo == null) {
if (this.cache != null) {
this.cache.cacheNotFound(filePath);
}
return null;
}
if (fileHeaderInfo.isDirectory()) {
bAbstractFileStore = BDaemonDirectoryStore.make(this, filePath, this.recurseDirs, this.getCrcs, this.getLocalPaths, this.cache);
} else if (filePath.depth() == 1 || !this.getCrcs) {
bAbstractFileStore = new BDaemonFileStore(this, filePath, fileHeaderInfo.getContentLength(), -1);
if (this.cache != null) {
this.cache.cacheResult((BIFileStore)bAbstractFileStore);
}
} else {
BDaemonDirectoryStore bDaemonDirectoryStore = BDaemonDirectoryStore.make(this, filePath.getParent(), this.recurseDirs, true, this.getLocalPaths, this.cache);
if (bDaemonDirectoryStore == null) {
bAbstractFileStore = new BDaemonFileStore(this, filePath, fileHeaderInfo.getContentLength(), -1);
if (this.cache != null) {
this.cache.cacheResult((BIFileStore)bAbstractFileStore);
}
} else {
bAbstractFileStore = bDaemonDirectoryStore.getChild(filePath.getName());
}
}
return bAbstractFileStore;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public BIFile getChild(BIFile bIFile, String string, BCacheAccessPolicy bCacheAccessPolicy) {
if (bIFile.isDirectory()) {
BIFileStore bIFileStore = null;
BDaemonDirectoryStore bDaemonDirectoryStore = (BDaemonDirectoryStore)bIFile.getStore();
bIFileStore = bDaemonDirectoryStore.getChild(string, bCacheAccessPolicy);
return bIFileStore == null ? null : this.makeFile(bIFileStore);
}
return null;
}
public BIFile[] getChildren(BIFile bIFile, BCacheAccessPolicy bCacheAccessPolicy) {
if (bIFile.isDirectory()) {
BDaemonDirectoryStore bDaemonDirectoryStore = (BDaemonDirectoryStore)bIFile.getStore();
Array array = bDaemonDirectoryStore.getChildren(bCacheAccessPolicy);
BIFile[] bIFileArray = new BIFile[array.size()];
int n = 0;
while (n < bIFileArray.length) {
bIFileArray[n] = this.makeFile((BIFileStore)array.get(n));
++n;
}
return bIFileArray;
}
return null;
}
public BIFile findFile(FilePath filePath, BCacheAccessPolicy bCacheAccessPolicy) {
try {
BIFileStore bIFileStore = this.findStore(filePath, bCacheAccessPolicy);
if (bIFileStore == null) {
return null;
}
if (bIFileStore instanceof BDaemonDirectoryStore) {
return new BDirectory(bIFileStore);
}
return this.makeFile(bIFileStore);
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public StoreCache getCache() {
return this.cache;
}
public BOrd getOrdInSession() {
throw new UnsupportedOperationException();
}
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 BCachedDaemonFileSpace(BDaemonSession bDaemonSession, boolean bl, boolean bl2, boolean bl3, IPlatformOperationListener iPlatformOperationListener) {
this.session = bDaemonSession;
this.recurseDirs = bl;
this.getCrcs = bl2;
this.getLocalPaths = bl3;
this.cache = new StoreCache();
this.cancelHint = new PlatformOperationListener(iPlatformOperationListener);
this.taskListener = (DaemonSessionTaskListener)((Object)this.cancelHint);
}
public BCachedDaemonFileSpace(BDaemonSession bDaemonSession, boolean bl, boolean bl2, boolean bl3) {
this(bDaemonSession, bl, bl2, bl3, null, null);
}
public BCachedDaemonFileSpace(BDaemonSession bDaemonSession, boolean bl, boolean bl2, boolean bl3, ICancelHint iCancelHint, DaemonSessionTaskListener daemonSessionTaskListener) {
this.session = bDaemonSession;
this.recurseDirs = bl;
this.getCrcs = bl2;
this.getLocalPaths = bl3;
this.cache = new StoreCache();
this.cancelHint = iCancelHint;
this.taskListener = daemonSessionTaskListener;
}
static {
Class clazz = class$com$tridium$platform$daemon$file$BCachedDaemonFileSpace;
if (clazz == null) {
clazz = class$com$tridium$platform$daemon$file$BCachedDaemonFileSpace = BCachedDaemonFileSpace.class("[Lcom.tridium.platform.daemon.file.BCachedDaemonFileSpace;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,325 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.file.BAbstractFileStore
* javax.baja.file.BFileSpace
* javax.baja.file.BIFileStore
* javax.baja.file.FilePath
* javax.baja.log.Log
* javax.baja.naming.SyntaxException
* javax.baja.nre.util.Array
* javax.baja.security.AuthenticationException
* javax.baja.sys.Clock
* javax.baja.sys.LocalizableRuntimeException
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.xml.XElem
* javax.baja.xml.XParser
*/
package com.tridium.platform.daemon.file;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.file.BCacheAccessPolicy;
import com.tridium.platform.daemon.file.BDaemonFileSpace;
import com.tridium.platform.daemon.file.BDaemonFileStore;
import com.tridium.platform.daemon.file.StoreCache;
import com.tridium.platform.daemon.message.DaemonMessage;
import com.tridium.platform.daemon.message.GetDirectoryMessage;
import com.tridium.platform.daemon.task.DaemonSessionTaskListener;
import java.io.InputStream;
import java.net.ConnectException;
import javax.baja.file.BAbstractFileStore;
import javax.baja.file.BFileSpace;
import javax.baja.file.BIFileStore;
import javax.baja.file.FilePath;
import javax.baja.log.Log;
import javax.baja.naming.SyntaxException;
import javax.baja.nre.util.Array;
import javax.baja.security.AuthenticationException;
import javax.baja.sys.Clock;
import javax.baja.sys.LocalizableRuntimeException;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.xml.XElem;
import javax.baja.xml.XParser;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BDaemonDirectoryStore
extends BAbstractFileStore {
public static final Type TYPE;
private String fileUri;
private XElem element;
private boolean recurseDir;
private boolean sendCrc;
private boolean sendLocalPath;
private StoreCache cache;
private FilePath altPath;
private Array children;
static /* synthetic */ Class class$com$tridium$platform$daemon$file$BDaemonDirectoryStore;
public Type getType() {
return TYPE;
}
public static BDaemonDirectoryStore make(BDaemonFileSpace bDaemonFileSpace, FilePath filePath) throws ConnectException, SecurityException {
return BDaemonDirectoryStore.make(bDaemonFileSpace, filePath, false, false, true, null);
}
public static BDaemonDirectoryStore make(BDaemonFileSpace bDaemonFileSpace, FilePath filePath, StoreCache storeCache) throws ConnectException, SecurityException {
return BDaemonDirectoryStore.make(bDaemonFileSpace, filePath, false, false, true, storeCache);
}
public static BDaemonDirectoryStore make(BDaemonFileSpace bDaemonFileSpace, FilePath filePath, boolean bl, boolean bl2, boolean bl3, StoreCache storeCache) throws ConnectException, SecurityException {
return BDaemonDirectoryStore.make(bDaemonFileSpace, filePath, bl, bl2, bl3, storeCache, BDaemonSession.DEFAULT_TIMEOUT);
}
public static BDaemonDirectoryStore make(BDaemonFileSpace bDaemonFileSpace, FilePath filePath, boolean bl, boolean bl2, boolean bl3, StoreCache storeCache, int n) throws ConnectException, SecurityException {
XElem xElem;
FilePath filePath2 = bDaemonFileSpace.getAltPath(filePath);
if (storeCache != null) {
int n2 = storeCache.getCacheStatus(filePath);
if (n2 == 1) {
return null;
}
if (n2 == 0) {
return (BDaemonDirectoryStore)storeCache.getStore(filePath);
}
}
long l = Clock.ticks();
InputStream inputStream = bDaemonFileSpace.getDaemonSession().getInputStream((DaemonMessage)new GetDirectoryMessage(filePath, bl, bl2, bl3, bDaemonFileSpace), n);
if (inputStream == null) {
if (storeCache != null) {
storeCache.cacheNotFound(filePath);
if (filePath2 != null) {
storeCache.cacheNotFound(filePath2);
}
}
Log.getLog((String)"platform.daemonTuning").trace("parsed " + filePath.getBody() + ' ' + (Clock.ticks() - l) + "ms");
return null;
}
try {
xElem = XParser.make((InputStream)inputStream).parse();
}
catch (Exception exception) {
Log.getLog((String)"platform.daemonTuning").trace("parse failed " + filePath.getBody() + ' ' + (Clock.ticks() - l) + "ms");
throw new LocalizableRuntimeException("platform", "RemoteDirectory.exception.contentParse", new Object[]{filePath.getBody()}, (Throwable)exception);
}
BDaemonDirectoryStore bDaemonDirectoryStore = new BDaemonDirectoryStore(bDaemonFileSpace, filePath, (XElem)(bl ? xElem : null), bl, bl2, bl3, storeCache);
if (storeCache != null) {
storeCache.cacheResult((BIFileStore)bDaemonDirectoryStore);
if (filePath2 != null) {
storeCache.cacheResult((BIFileStore)new BDaemonDirectoryStore(bDaemonFileSpace, filePath2, (XElem)(bl ? xElem : null), bl, bl2, bl3, storeCache));
}
if (bl) {
storeCache.cacheCompleted(filePath);
if (filePath2 != null) {
storeCache.cacheCompleted(filePath2);
}
}
}
Log.getLog((String)"platform.daemonTuning").trace("parsed " + filePath.getBody() + ' ' + (Clock.ticks() - l) + "ms");
return bDaemonDirectoryStore;
}
public BDaemonFileSpace getDaemonFileSpace() {
return (BDaemonFileSpace)this.getFileSpace();
}
public void reset() {
this.children = null;
this.element = null;
if (this.cache != null) {
this.cache.clear(this.getFilePath());
if (this.getAltPath() != null) {
this.cache.clear(this.getAltPath());
}
}
}
public boolean isReadonly() {
return true;
}
public boolean isDirectory() {
return true;
}
public String getFileUri() {
return this.fileUri;
}
public String getLocalPath() {
if (this.element == null) {
this.getChildren(BCacheAccessPolicy.lazyFetch);
}
return this.element.get("path", null);
}
public boolean copyToLocalHost() throws ConnectException, AuthenticationException {
return this.copyToLocalHost(this.getFilePath(), null);
}
public boolean copyToLocalHost(FilePath filePath) throws ConnectException, AuthenticationException {
return this.copyToLocalHost(filePath, null);
}
public boolean copyToLocalHost(FilePath filePath, DaemonSessionTaskListener daemonSessionTaskListener) throws ConnectException, AuthenticationException {
if (!this.getFilePath().isSysHomeAbsolute()) {
throw new IllegalStateException("Only system absolute files can be copied to local host");
}
Array array = this.getChildren();
int n = 0;
while (n < array.size()) {
BAbstractFileStore bAbstractFileStore;
if (array.get(n) instanceof BDaemonDirectoryStore ? !(bAbstractFileStore = (BDaemonDirectoryStore)((Object)array.get(n))).copyToLocalHost(filePath.merge(bAbstractFileStore.getFileName()), daemonSessionTaskListener) : !(bAbstractFileStore = (BDaemonFileStore)((Object)array.get(n))).copyToLocalHost(filePath.merge(bAbstractFileStore.getFileName()), daemonSessionTaskListener)) {
return false;
}
++n;
}
return true;
}
public FilePath getAltPath() {
return this.altPath;
}
public BDaemonSession getDaemonSession() {
return ((BDaemonFileSpace)this.getFileSpace()).getDaemonSession();
}
public BIFileStore getChild(String string) {
return this.getChild(string, BCacheAccessPolicy.lazyFetch);
}
public BIFileStore getChild(String string, BCacheAccessPolicy bCacheAccessPolicy) {
if (this.getChildren(bCacheAccessPolicy) == null) {
return null;
}
int n = 0;
while (n < this.children.size()) {
if (((BIFileStore)this.children.get(n)).getFileName().equals(string)) {
return (BIFileStore)this.children.get(n);
}
++n;
}
if (this.cache != null) {
this.cache.cacheNotFound(this.getFilePath().merge(string));
if (this.getAltPath() != null) {
this.cache.cacheNotFound(this.getAltPath().merge(string));
}
}
return null;
}
public Array getChildren() {
return this.getChildren(BCacheAccessPolicy.lazyFetch, this.recurseDir, this.sendCrc, this.sendLocalPath);
}
public Array getChildren(BCacheAccessPolicy bCacheAccessPolicy) {
return this.getChildren(bCacheAccessPolicy, this.recurseDir, this.sendCrc, this.sendLocalPath);
}
public Array getChildren(BCacheAccessPolicy bCacheAccessPolicy, boolean bl, boolean bl2, boolean bl3) {
long l = Clock.ticks();
if (bCacheAccessPolicy == BCacheAccessPolicy.forceFetch || bCacheAccessPolicy == BCacheAccessPolicy.lazyFetch && this.element == null) {
try {
this.element = XParser.make((InputStream)this.getDaemonSession().getInputStream(new GetDirectoryMessage(this.getFilePath(), bl, bl2, bl3, this.getDaemonFileSpace()))).parse();
Log.getLog((String)"platform.daemonTuning").trace("parsed " + this.getFilePath().getBody() + ' ' + (Clock.ticks() - l) + "ms");
}
catch (Exception exception) {
Log.getLog((String)"platform.daemonTuning").trace("parse failed " + this.getFilePath().getBody() + ' ' + (Clock.ticks() - l) + "ms");
throw new LocalizableRuntimeException("platform", "RemoteDirectory.exception.contentParse", new Object[]{this.getFileUri()}, (Throwable)exception);
}
this.children = null;
}
if (this.children == null && bCacheAccessPolicy != BCacheAccessPolicy.cacheOnly) {
XElem[] xElemArray = this.element.elems();
this.children = new Array();
int n = 0;
while (n < xElemArray.length) {
BAbstractFileStore bAbstractFileStore;
if (xElemArray[n].name().equals("file")) {
try {
bAbstractFileStore = new BDaemonFileStore(this.getDaemonFileSpace(), this.getFilePath().merge(xElemArray[n].get("name")), xElemArray[n]);
if (this.cache != null) {
this.cache.cacheResult((BIFileStore)bAbstractFileStore);
if (this.getAltPath() != null) {
this.cache.cacheResult((BIFileStore)new BDaemonFileStore(this.getDaemonFileSpace(), this.getAltPath().merge(xElemArray[n].get("name")), xElemArray[n]));
}
}
this.children.add((Object)bAbstractFileStore);
}
catch (SyntaxException syntaxException) {
Log.getLog((String)"platform.daemonTuning").trace("ignoring illegal child " + xElemArray[n].get("name") + " of " + this.getFilePath());
}
} else if (xElemArray[n].name().equals("directory")) {
try {
bAbstractFileStore = new BDaemonDirectoryStore(this.getDaemonFileSpace(), this.getFilePath().merge(xElemArray[n].get("name")), bl ? xElemArray[n] : null, bl, bl2, bl3, this.cache);
if (this.cache != null) {
this.cache.cacheResult((BIFileStore)bAbstractFileStore);
if (this.getAltPath() != null) {
this.cache.cacheResult((BIFileStore)new BDaemonDirectoryStore(this.getDaemonFileSpace(), this.getAltPath().merge(xElemArray[n].get("name")), bl ? xElemArray[n] : null, bl, bl2, bl3, this.cache));
}
}
this.children.add((Object)bAbstractFileStore);
}
catch (SyntaxException syntaxException) {
Log.getLog((String)"platform.daemonTuning").trace("ignoring illegal child " + xElemArray[n].get("name") + " of " + this.getFilePath());
}
}
++n;
}
if (this.cache != null) {
this.cache.cacheCompleted(this.getFilePath());
if (this.getAltPath() != null) {
this.cache.cacheCompleted(this.getAltPath());
}
}
}
return this.children;
}
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.children = null;
}
private BDaemonDirectoryStore(BDaemonFileSpace bDaemonFileSpace, FilePath filePath, XElem xElem, boolean bl, boolean bl2, boolean bl3, StoreCache storeCache) {
super((BFileSpace)bDaemonFileSpace, filePath);
this.this();
this.fileUri = bDaemonFileSpace.filePathToUri(filePath);
this.element = xElem;
this.recurseDir = bl;
this.sendCrc = bl2;
this.sendLocalPath = bl3;
this.cache = storeCache;
this.altPath = bDaemonFileSpace.getAltPath(filePath);
if (bl) {
this.getChildren(BCacheAccessPolicy.lazyFetch, true, bl2, bl3);
}
}
static {
Class clazz = class$com$tridium$platform$daemon$file$BDaemonDirectoryStore;
if (clazz == null) {
clazz = class$com$tridium$platform$daemon$file$BDaemonDirectoryStore = BDaemonDirectoryStore.class("[Lcom.tridium.platform.daemon.file.BDaemonDirectoryStore;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,382 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.net.HttpUtil
* javax.baja.file.BDirectory
* javax.baja.file.BFileSpace
* javax.baja.file.BIFile
* javax.baja.file.BIFileStore
* javax.baja.file.FilePath
* javax.baja.naming.BOrd
* javax.baja.nav.BNavRoot
* javax.baja.nav.NavEvent
* javax.baja.security.AuthenticationException
* javax.baja.sys.BIcon
* javax.baja.sys.BajaRuntimeException
* javax.baja.sys.Context
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.util.LexiconText
*/
package com.tridium.platform.daemon.file;
import com.tridium.net.HttpUtil;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.file.BCacheAccessPolicy;
import com.tridium.platform.daemon.file.BDaemonDirectoryStore;
import com.tridium.platform.daemon.file.FileCache;
import com.tridium.platform.daemon.file.FilePathComparator;
import java.net.ConnectException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Set;
import java.util.TreeSet;
import javax.baja.file.BDirectory;
import javax.baja.file.BFileSpace;
import javax.baja.file.BIFile;
import javax.baja.file.BIFileStore;
import javax.baja.file.FilePath;
import javax.baja.naming.BOrd;
import javax.baja.nav.BNavRoot;
import javax.baja.nav.NavEvent;
import javax.baja.security.AuthenticationException;
import javax.baja.sys.BIcon;
import javax.baja.sys.BajaRuntimeException;
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 BDaemonFileSpace
extends BFileSpace {
public static final Type TYPE;
protected FilePath sysHomePathFromRoot;
protected BDirectory[] roots;
protected boolean initializing;
static /* synthetic */ Class class$com$tridium$platform$daemon$file$BDaemonFileSpace;
public Type getType() {
return TYPE;
}
public abstract BDaemonSession getDaemonSession();
/*
* 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 init() throws ConnectException, AuthenticationException {
if (this.initializing) return;
if (this.roots != null) {
return;
}
this.initializing = true;
try {
ArrayList<BDirectory> arrayList;
block8: {
Object object;
arrayList = new ArrayList<BDirectory>();
String string = null;
BDaemonDirectoryStore bDaemonDirectoryStore = BDaemonDirectoryStore.make(this, new FilePath("!"));
if (bDaemonDirectoryStore != null) {
object = new BDirectory((BIFileStore)bDaemonDirectoryStore, LexiconText.make((String)"platform", (String)"nav.sysHomeReadOnly"));
string = bDaemonDirectoryStore.getLocalPath();
object.setIcon(BIcon.std((String)"home.png"));
arrayList.add((BDirectory)object);
}
try {
bDaemonDirectoryStore = BDaemonDirectoryStore.make(this, new FilePath("/"));
if (bDaemonDirectoryStore == null) break block8;
arrayList.add(new BDirectory((BIFileStore)bDaemonDirectoryStore, LexiconText.make((String)"platform", (String)"nav.rootReadOnly")));
if (string != null && string.startsWith((String)(object = bDaemonDirectoryStore.getLocalPath()))) {
this.sysHomePathFromRoot = new FilePath(string.substring(((String)object).length()));
}
}
catch (Exception exception) {}
}
this.roots = arrayList.toArray(new BDirectory[arrayList.size()]);
}
catch (Throwable throwable) {
Object var2_6 = null;
this.initializing = false;
throw throwable;
}
{
Object var2_7 = null;
this.initializing = false;
return;
}
}
public String filePathToUri(FilePath filePath) {
StringBuffer stringBuffer;
String[] stringArray = filePath.getNames();
int n = 0;
if (filePath.isLocalAbsolute()) {
if (stringArray.length > 0 && stringArray[0].equals("niagara")) {
stringBuffer = new StringBuffer("/niagara");
n = 1;
} else {
stringBuffer = new StringBuffer("/files");
}
} else if (filePath.isSysHomeAbsolute()) {
stringBuffer = new StringBuffer("/niagara");
} else {
throw new BajaRuntimeException("file path must be local or sys home absolute " + filePath.getBody());
}
int n2 = n;
while (n2 < stringArray.length) {
stringBuffer.append('/');
stringBuffer.append(HttpUtil.encodeUrl((String)stringArray[n2]));
++n2;
}
return stringBuffer.toString();
}
public boolean hasNavChildren() {
return true;
}
public String getNavDescription(Context context) {
return this.getLexicon().getText("DaemonFileSpace.navDesc");
}
public FilePath getAltPath(FilePath filePath) {
if (this.initializing) {
return null;
}
try {
this.init();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
if (this.sysHomePathFromRoot == null) {
return null;
}
if (filePath.isLocalAbsolute()) {
if (filePath.depth() < this.sysHomePathFromRoot.depth()) {
return null;
}
int n = 0;
while (n < this.sysHomePathFromRoot.depth()) {
if (!filePath.nameAt(n).equals(this.sysHomePathFromRoot.nameAt(n))) {
return null;
}
++n;
}
FilePath filePath2 = new FilePath("!");
int n2 = this.sysHomePathFromRoot.depth();
while (n2 < filePath.depth()) {
filePath2 = filePath2.merge(filePath.nameAt(n2));
++n2;
}
return filePath2;
}
if (filePath.isSysHomeAbsolute()) {
FilePath filePath3 = new FilePath("/");
filePath3 = filePath3.merge(this.sysHomePathFromRoot);
int n = 0;
while (n < filePath.depth()) {
filePath3 = filePath3.merge(filePath.nameAt(n));
++n;
}
return filePath3;
}
return null;
}
public BIFile[] listFiles() {
try {
this.init();
return (BIFile[])this.roots.clone();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public BIFile getChild(BIFile bIFile, String string) {
return this.getChild(bIFile, string, BCacheAccessPolicy.forceFetch);
}
public BIFile[] getChildren(BIFile bIFile) {
return this.getChildren(bIFile, BCacheAccessPolicy.forceFetch);
}
public BIFile findFile(FilePath filePath) {
return this.findFile(filePath, BCacheAccessPolicy.forceFetch);
}
public BIFileStore findStore(FilePath filePath) {
return this.findStore(filePath, BCacheAccessPolicy.forceFetch);
}
public abstract BIFile getChild(BIFile var1, String var2, BCacheAccessPolicy var3);
public abstract BIFile[] getChildren(BIFile var1, BCacheAccessPolicy var2);
public abstract BIFile findFile(FilePath var1, BCacheAccessPolicy var2);
public abstract BIFileStore findStore(FilePath var1, BCacheAccessPolicy var2);
public void notify(Set set, Set set2) {
BIFile bIFile;
BDirectory bDirectory;
Object object;
FileCache fileCache = new FileCache(this);
TreeSet<NavEvent> treeSet = new TreeSet<NavEvent>(new Comparator(){
public final int compare(Object object, Object object2) {
NavEvent navEvent = (NavEvent)object;
NavEvent navEvent2 = (NavEvent)object2;
if (navEvent.getId() != navEvent2.getId()) {
return navEvent.getId() < navEvent2.getId() ? 1 : -1;
}
int n = navEvent.getParentOrd().toString().compareTo(navEvent2.getParentOrd().toString());
if (n != 0) {
return n;
}
if (navEvent.getId() == 1) {
return navEvent.getNewChildName().compareTo(navEvent2.getNewChildName());
}
return navEvent.getOldChildName().compareTo(navEvent2.getOldChildName());
}
});
TreeSet<FilePath> treeSet2 = new TreeSet<FilePath>(FilePathComparator.INSTANCE);
treeSet2.addAll(set);
Object object2 = set.iterator();
while (object2.hasNext()) {
object = this.getAltPath((FilePath)object2.next());
if (object == null) continue;
treeSet2.add((FilePath)object);
}
object2 = treeSet2.iterator();
while (object2.hasNext()) {
object = (FilePath)object2.next();
bDirectory = this.findDirectoryForNotify(object.getParent(), fileCache);
if (bDirectory == null || (bIFile = this.getChild((BIFile)bDirectory, object.getName(), BCacheAccessPolicy.cacheOnly)) == null) continue;
treeSet.add(NavEvent.makeRemoved((BOrd)bDirectory.getNavOrd(), (String)object.getName(), null));
}
object2 = new TreeSet(FilePathComparator.INSTANCE);
object2.addAll(set2);
object = set2.iterator();
while (object.hasNext()) {
bIFile = this.getAltPath((FilePath)object.next());
if (bIFile == null) continue;
object2.add(bIFile);
}
object = object2.iterator();
block3: while (object.hasNext()) {
BIFile bIFile2;
bIFile = (FilePath)object.next();
bDirectory = this.findDirectoryForNotify(bIFile.getParent(), fileCache);
if (bDirectory == null) {
bIFile2 = (BIFile)this.getNavChild(bIFile.getAbsoluteBase());
if (bIFile2 == null) continue;
int n = 0;
while (n < bIFile.depth() - 1) {
BIFile bIFile3 = this.getChild(bIFile2, bIFile.nameAt(n), BCacheAccessPolicy.cacheOnly);
if (bIFile3 == null) {
treeSet.add(NavEvent.makeAdded((BOrd)bIFile2.getNavOrd(), (String)bIFile.nameAt(n), null));
continue block3;
}
bIFile2 = bIFile3;
++n;
}
continue;
}
bIFile2 = this.getChild((BIFile)bDirectory, bIFile.getName(), BCacheAccessPolicy.cacheOnly);
if (bIFile2 == null) continue;
treeSet.add(NavEvent.makeAdded((BOrd)bDirectory.getNavOrd(), (String)bIFile.getName(), null));
}
object = fileCache.getCachedFiles().iterator();
while (object.hasNext()) {
bDirectory = (BDirectory)object.next();
((BDaemonDirectoryStore)bDirectory.getStore()).reset();
}
object = treeSet.iterator();
while (object.hasNext()) {
bIFile = (NavEvent)object.next();
BNavRoot.INSTANCE.fireNavEvent((NavEvent)bIFile);
}
}
private final BDirectory findDirectoryForNotify(FilePath filePath, FileCache fileCache) {
if (filePath == null) {
return null;
}
switch (fileCache.getCacheStatus(filePath)) {
case 2: {
BDirectory bDirectory = (BDirectory)this.findFile(filePath, BCacheAccessPolicy.cacheOnly);
if (bDirectory == null) {
fileCache.cacheNotFound(filePath);
} else {
fileCache.cacheResult((BIFile)bDirectory);
}
return bDirectory;
}
case 0: {
return (BDirectory)fileCache.getFile(filePath);
}
}
return null;
}
public void notifyTransferred(FilePath filePath) {
TreeSet<FilePath> treeSet = new TreeSet<FilePath>(FilePathComparator.INSTANCE);
treeSet.add(filePath);
this.notify(new TreeSet(FilePathComparator.INSTANCE), treeSet);
}
public void notifyRemoved(FilePath filePath) {
TreeSet<FilePath> treeSet = new TreeSet<FilePath>(FilePathComparator.INSTANCE);
treeSet.add(filePath);
this.notify(treeSet, new TreeSet(FilePathComparator.INSTANCE));
}
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.sysHomePathFromRoot = null;
this.roots = null;
this.initializing = false;
}
public BDaemonFileSpace() {
super("file", LexiconText.make((String)"platform", (String)"nav.daemonFileSpace"));
this.this();
}
static {
Class clazz = class$com$tridium$platform$daemon$file$BDaemonFileSpace;
if (clazz == null) {
clazz = class$com$tridium$platform$daemon$file$BDaemonFileSpace = BDaemonFileSpace.class("[Lcom.tridium.platform.daemon.file.BDaemonFileSpace;", false);
}
TYPE = Sys.loadType((Class)clazz);
}
}
@@ -0,0 +1,185 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.net.HttpDateFormat
* javax.baja.file.BAbstractFileStore
* javax.baja.file.BFileSpace
* javax.baja.file.FilePath
* javax.baja.file.FileUtil
* javax.baja.security.AuthenticationException
* javax.baja.sys.BAbsTime
* javax.baja.sys.LocalizableRuntimeException
* javax.baja.sys.Sys
* javax.baja.sys.Type
* javax.baja.util.Lexicon
* javax.baja.xml.XElem
*/
package com.tridium.platform.daemon.file;
import com.tridium.net.HttpDateFormat;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.DaemonFileUtil;
import com.tridium.platform.daemon.file.BDaemonFileSpace;
import com.tridium.platform.daemon.file.FileHeaderInfo;
import com.tridium.platform.daemon.message.FileHeaderMessage;
import com.tridium.platform.daemon.message.GetFileMessage;
import com.tridium.platform.daemon.task.DaemonSessionTaskListener;
import java.io.IOException;
import java.io.InputStream;
import java.net.ConnectException;
import javax.baja.file.BAbstractFileStore;
import javax.baja.file.BFileSpace;
import javax.baja.file.FilePath;
import javax.baja.file.FileUtil;
import javax.baja.security.AuthenticationException;
import javax.baja.sys.BAbsTime;
import javax.baja.sys.LocalizableRuntimeException;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.util.Lexicon;
import javax.baja.xml.XElem;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BDaemonFileStore
extends BAbstractFileStore {
public static final Type TYPE;
private static Lexicon lex;
private String fileUri;
private long size;
private long crc;
private BAbsTime lastModified;
static /* synthetic */ Class class$com$tridium$platform$daemon$file$BDaemonFileStore;
public Type getType() {
return TYPE;
}
public String getFileUri() {
return this.fileUri;
}
public BDaemonFileSpace getDaemonFileSpace() {
return (BDaemonFileSpace)this.getFileSpace();
}
public BAbsTime getLastModified() {
return this.lastModified;
}
public long getSize() {
return this.size;
}
public long getCrc() throws IOException {
if (this.crc == (long)-1) {
this.crc = 0L;
FileHeaderInfo fileHeaderInfo = DaemonFileUtil.getFileHeaderInfo(this.getDaemonSession(), new FileHeaderMessage(this.getFilePath(), this.getDaemonFileSpace(), true));
if (fileHeaderInfo != null && fileHeaderInfo.getCrc() > (long)-1) {
this.crc = fileHeaderInfo.getCrc();
} else {
try {
this.crc = FileUtil.getCrc((InputStream)this.getInputStream());
}
catch (IOException iOException) {
throw new LocalizableRuntimeException("platform", "LocalFile.exception.readCrc", (Throwable)iOException);
}
}
}
return this.crc;
}
public boolean isReadonly() {
return true;
}
public InputStream getInputStream() throws IOException {
GetFileMessage getFileMessage = new GetFileMessage(this.getFilePath(), this.getDaemonFileSpace());
return this.getDaemonSession().getInputStream(getFileMessage);
}
public BDaemonSession getDaemonSession() {
return ((BDaemonFileSpace)this.getFileSpace()).getDaemonSession();
}
public boolean copyToLocalHost() throws ConnectException, AuthenticationException {
return this.copyToLocalHost(this.getFilePath(), null);
}
public boolean copyToLocalHost(FilePath filePath) throws ConnectException, AuthenticationException {
return this.copyToLocalHost(filePath, null);
}
/*
* Exception decompiling
*/
public boolean copyToLocalHost(FilePath var1_1, DaemonSessionTaskListener var2_2) throws ConnectException, AuthenticationException {
/*
* This method has failed to decompile. When submitting a bug report, please provide this stack trace, and (if you hold appropriate legal rights) the relevant class file.
*
* org.benf.cfr.reader.util.ConfusedCFRException: Back jump on a try block [egrp 8[TRYBLOCK] [13 : 280->283)] java.lang.Throwable
* at org.benf.cfr.reader.bytecode.analysis.opgraph.Op02WithProcessedDataAndRefs.insertExceptionBlocks(Op02WithProcessedDataAndRefs.java:2283)
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisInner(CodeAnalyser.java:415)
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisOrWrapFail(CodeAnalyser.java:278)
* at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysis(CodeAnalyser.java:201)
* at org.benf.cfr.reader.entities.attributes.AttributeCode.analyse(AttributeCode.java:94)
* at org.benf.cfr.reader.entities.Method.analyse(Method.java:531)
* at org.benf.cfr.reader.entities.ClassFile.analyseMid(ClassFile.java:1055)
* at org.benf.cfr.reader.entities.ClassFile.analyseTop(ClassFile.java:942)
* at org.benf.cfr.reader.Driver.doJarVersionTypes(Driver.java:257)
* at org.benf.cfr.reader.Driver.doJar(Driver.java:139)
* at org.benf.cfr.reader.CfrDriverImpl.analyse(CfrDriverImpl.java:76)
* at org.benf.cfr.reader.Main.main(Main.java:54)
*/
throw new IllegalStateException("Decompilation failed");
}
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.lastModified = BAbsTime.NULL;
}
public BDaemonFileStore(BDaemonFileSpace bDaemonFileSpace, FilePath filePath) {
this(bDaemonFileSpace, filePath, -1, -1);
}
public BDaemonFileStore(BDaemonFileSpace bDaemonFileSpace, FilePath filePath, long l, long l2) {
super((BFileSpace)bDaemonFileSpace, filePath);
this.this();
this.fileUri = bDaemonFileSpace.filePathToUri(filePath);
this.size = l;
this.crc = l2;
}
public BDaemonFileStore(BDaemonFileSpace bDaemonFileSpace, FilePath filePath, XElem xElem) {
this(bDaemonFileSpace, filePath, Long.parseLong(xElem.get("size", "-1")), Long.parseLong(xElem.get("crc", "-1")));
String string = xElem.get("lastModified", null);
if (string != null) {
this.lastModified = BAbsTime.make((long)HttpDateFormat.parse((String)string));
}
}
static {
Class clazz = class$com$tridium$platform$daemon$file$BDaemonFileStore;
if (clazz == null) {
clazz = class$com$tridium$platform$daemon$file$BDaemonFileStore = BDaemonFileStore.class("[Lcom.tridium.platform.daemon.file.BDaemonFileStore;", false);
}
TYPE = Sys.loadType((Class)clazz);
lex = Lexicon.make((String)"platform");
}
}
@@ -0,0 +1,273 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.file.BAbstractFileStore
* javax.baja.file.BDirectory
* javax.baja.file.BIFile
* javax.baja.file.BIFileStore
* javax.baja.file.FilePath
* javax.baja.naming.BOrd
* javax.baja.nav.BINavNode
* javax.baja.nre.util.Array
* javax.baja.security.AuthenticationException
* javax.baja.sys.BIcon
* javax.baja.sys.BajaRuntimeException
* javax.baja.sys.Context
* javax.baja.sys.LocalizableRuntimeException
* javax.baja.sys.Sys
* javax.baja.sys.Type
*/
package com.tridium.platform.daemon.file;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.DaemonFileUtil;
import com.tridium.platform.daemon.file.BCacheAccessPolicy;
import com.tridium.platform.daemon.file.BDaemonDirectoryStore;
import com.tridium.platform.daemon.file.BDaemonFileSpace;
import com.tridium.platform.daemon.file.BDaemonFileStore;
import com.tridium.platform.daemon.file.FileHeaderInfo;
import com.tridium.platform.daemon.file.StoreCache;
import com.tridium.platform.daemon.message.FileHeaderMessage;
import java.io.IOException;
import java.net.ConnectException;
import javax.baja.file.BAbstractFileStore;
import javax.baja.file.BDirectory;
import javax.baja.file.BIFile;
import javax.baja.file.BIFileStore;
import javax.baja.file.FilePath;
import javax.baja.naming.BOrd;
import javax.baja.nav.BINavNode;
import javax.baja.nre.util.Array;
import javax.baja.security.AuthenticationException;
import javax.baja.sys.BIcon;
import javax.baja.sys.BajaRuntimeException;
import javax.baja.sys.Context;
import javax.baja.sys.LocalizableRuntimeException;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BDefaultDaemonFileSpace
extends BDaemonFileSpace {
public static final Type TYPE;
private static final BIcon icon;
private BOrd ordInSession = BOrd.make((String)"file:");
static /* synthetic */ Class class$com$tridium$platform$daemon$file$BDefaultDaemonFileSpace;
public Type getType() {
return TYPE;
}
public BDaemonSession getDaemonSession() {
return (BDaemonSession)this.getNavParent();
}
protected void init() throws ConnectException, AuthenticationException {
if (this.roots != null) {
return;
}
super.init();
}
public boolean hasNavChildren() {
return true;
}
public BINavNode getNavChild(String string) {
try {
this.init();
int n = 0;
while (n < this.roots.length) {
if (this.roots[n].getFileName().equals(string)) {
return this.roots[n];
}
++n;
}
return null;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public BINavNode[] getNavChildren() {
try {
this.init();
return (BINavNode[])this.roots.clone();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public BOrd getOrdInSession() {
return this.ordInSession;
}
public String getNavDescription(Context context) {
return this.getLexicon().getText("DaemonFileSpace.navDesc");
}
public BDirectory makeDir(FilePath filePath, Context context) throws IOException {
throw new LocalizableRuntimeException("platform", "DaemonFileSpace.readonly");
}
public BIFile makeFile(FilePath filePath, Context context) throws IOException {
throw new LocalizableRuntimeException("platform", "DaemonFileSpace.readonly");
}
public void delete(FilePath filePath, Context context) throws IOException {
throw new LocalizableRuntimeException("platform", "DaemonFileSpace.readonly");
}
public void move(FilePath filePath, FilePath filePath2, Context context) throws IOException {
throw new LocalizableRuntimeException("platform", "DaemonFileSpace.readonly");
}
public BIFile findFile(FilePath filePath, BCacheAccessPolicy bCacheAccessPolicy) {
try {
BIFileStore bIFileStore = this.findStore(null, filePath, false, false, bCacheAccessPolicy);
if (bIFileStore == null) {
return null;
}
if (bIFileStore instanceof BDaemonDirectoryStore) {
return new BDirectory(bIFileStore);
}
return this.makeFile(bIFileStore);
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public BIFileStore findStore(FilePath filePath) {
try {
return this.findStore(null, filePath, false, false, BCacheAccessPolicy.lazyFetch);
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public BIFileStore findStore(FilePath filePath, BCacheAccessPolicy bCacheAccessPolicy) {
try {
return this.findStore(null, filePath, false, false, bCacheAccessPolicy);
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public BIFileStore findStore(StoreCache storeCache, FilePath filePath, boolean bl, boolean bl2) throws ConnectException, AuthenticationException, IOException {
return this.findStore(storeCache, filePath, bl, bl2, BCacheAccessPolicy.lazyFetch);
}
public BIFileStore findStore(StoreCache storeCache, FilePath filePath, boolean bl, boolean bl2, BCacheAccessPolicy bCacheAccessPolicy) throws ConnectException, AuthenticationException, IOException {
BAbstractFileStore bAbstractFileStore;
int n = bCacheAccessPolicy == BCacheAccessPolicy.forceFetch || storeCache == null ? 2 : storeCache.getCacheStatus(filePath);
if (n == 1) {
return null;
}
if (n == 0) {
return storeCache.getStore(filePath);
}
if (bCacheAccessPolicy == BCacheAccessPolicy.cacheOnly) {
return null;
}
FileHeaderInfo fileHeaderInfo = DaemonFileUtil.getFileHeaderInfo(this.getDaemonSession(), new FileHeaderMessage(filePath, this));
if (fileHeaderInfo == null) {
if (storeCache != null) {
storeCache.cacheNotFound(filePath);
}
return null;
}
if (fileHeaderInfo.isDirectory()) {
bAbstractFileStore = BDaemonDirectoryStore.make(this, filePath, bl, bl2, false, storeCache);
} else if (filePath.depth() == 1 || !bl2) {
bAbstractFileStore = new BDaemonFileStore(this, filePath, fileHeaderInfo.getContentLength(), -1);
if (storeCache != null) {
storeCache.cacheResult((BIFileStore)bAbstractFileStore);
}
} else {
BDaemonDirectoryStore bDaemonDirectoryStore = BDaemonDirectoryStore.make(this, filePath.getParent(), bl, true, false, storeCache);
if (bDaemonDirectoryStore == null) {
bAbstractFileStore = new BDaemonFileStore(this, filePath, fileHeaderInfo.getContentLength(), -1);
if (storeCache != null) {
storeCache.cacheResult((BIFileStore)bAbstractFileStore);
}
} else {
bAbstractFileStore = bDaemonDirectoryStore.getChild(filePath.getName());
}
}
return bAbstractFileStore;
}
public BIFile getChild(BIFile bIFile, String string, BCacheAccessPolicy bCacheAccessPolicy) {
if (bIFile.isDirectory()) {
BDaemonDirectoryStore bDaemonDirectoryStore = (BDaemonDirectoryStore)bIFile.getStore();
BIFileStore bIFileStore = bDaemonDirectoryStore.getChild(string, bCacheAccessPolicy);
return bIFileStore == null ? null : this.makeFile(bIFileStore);
}
return null;
}
public BIFile[] getChildren(BIFile bIFile, BCacheAccessPolicy bCacheAccessPolicy) {
if (bIFile.isDirectory()) {
BDaemonDirectoryStore bDaemonDirectoryStore = (BDaemonDirectoryStore)bIFile.getStore();
Array array = bDaemonDirectoryStore.getChildren(bCacheAccessPolicy);
BIFile[] bIFileArray = new BIFile[array.size()];
int n = 0;
while (n < bIFileArray.length) {
bIFileArray[n] = this.makeFile((BIFileStore)array.get(n));
++n;
}
return bIFileArray;
}
return null;
}
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$com$tridium$platform$daemon$file$BDefaultDaemonFileSpace;
if (clazz == null) {
clazz = class$com$tridium$platform$daemon$file$BDefaultDaemonFileSpace = BDefaultDaemonFileSpace.class("[Lcom.tridium.platform.daemon.file.BDefaultDaemonFileSpace;", false);
}
TYPE = Sys.loadType((Class)clazz);
icon = BIcon.std((String)"drive.png");
}
}
@@ -0,0 +1,301 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.file.BIFileStore
* javax.baja.file.FilePath
* javax.baja.nre.util.Array
*/
package com.tridium.platform.daemon.file;
import com.tridium.platform.daemon.file.BCacheAccessPolicy;
import com.tridium.platform.daemon.file.BDaemonDirectoryStore;
import com.tridium.platform.daemon.message.FileTransferMessage;
import java.util.Iterator;
import java.util.TreeMap;
import javax.baja.file.BIFileStore;
import javax.baja.file.FilePath;
import javax.baja.nre.util.Array;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class DirectoryClean {
private static final int UNKNOWN = 0;
private static final int KEEP_SOME = 1;
private static final int KEEP_ALL = 2;
private static final int CLEAN_SOME = 16;
private static final int CLEAN_ALL = 32;
private static final int CASCADE_PARENT = 1;
private static final int CASCADE_CHILD = 16;
private static final int CASCADE_ANY = 17;
private TreeMap sysHomeAbsRootsByName;
private TreeMap localAbsRootsByName;
public void clean(BIFileStore bIFileStore) {
if (bIFileStore == null) {
return;
}
FilePath filePath = this.normalizePath(bIFileStore.getFilePath());
Node node = this.makeNode(filePath);
node.setStore(bIFileStore);
node.transition(32);
}
public void keep(FilePath filePath) {
this.makeNode(this.normalizePath(filePath)).transition(2);
}
public void addTransferElements(FileTransferMessage fileTransferMessage) {
Iterator iterator = this.sysHomeAbsRootsByName.values().iterator();
while (iterator.hasNext()) {
((Node)iterator.next()).addTransferElements(fileTransferMessage);
}
iterator = this.localAbsRootsByName.values().iterator();
while (iterator.hasNext()) {
((Node)iterator.next()).addTransferElements(fileTransferMessage);
}
}
public void dump() {
Iterator iterator = this.sysHomeAbsRootsByName.values().iterator();
while (iterator.hasNext()) {
((Node)iterator.next()).dump("!");
}
iterator = this.localAbsRootsByName.values().iterator();
while (iterator.hasNext()) {
((Node)iterator.next()).dump("/");
}
}
private final FilePath normalizePath(FilePath filePath) {
if (filePath == null || filePath.isSysHomeAbsolute()) {
return filePath;
}
if (filePath.isLocalAbsolute()) {
if (filePath.depth() == 0 || !filePath.nameAt(0).equals("niagara")) {
return filePath;
}
FilePath filePath2 = new FilePath("!");
int n = 1;
while (n < filePath.depth()) {
filePath2 = filePath2.merge(filePath.nameAt(n));
++n;
}
return filePath2;
}
throw new IllegalArgumentException("path must be sys home or local absolute");
}
private final Node makeNode(FilePath filePath) {
if (filePath.depth() == 0) {
throw new IllegalArgumentException("root path");
}
TreeMap treeMap = null;
if (filePath.isSysHomeAbsolute()) {
treeMap = this.sysHomeAbsRootsByName;
} else if (filePath.isLocalAbsolute()) {
treeMap = this.localAbsRootsByName;
} else {
throw new IllegalArgumentException("Path must be sys home or local absolute");
}
Node node = (Node)treeMap.get(filePath.nameAt(0));
if (node == null) {
node = new Node(null, filePath.nameAt(0));
treeMap.put(filePath.nameAt(0), node);
}
int n = 1;
while (n < filePath.depth()) {
node = node.makeChild(filePath.nameAt(n));
++n;
}
return node;
}
static /* synthetic */ int access$0() {
return 0;
}
static /* synthetic */ int access$1() {
return 32;
}
static /* synthetic */ int access$2() {
return 16;
}
static /* synthetic */ int access$3() {
return 1;
}
static /* synthetic */ int access$4() {
return 2;
}
static /* synthetic */ int access$5() {
return 17;
}
static /* synthetic */ int access$6() {
return 1;
}
static /* synthetic */ int access$7() {
return 16;
}
private final /* synthetic */ void this() {
this.sysHomeAbsRootsByName = new TreeMap();
this.localAbsRootsByName = new TreeMap();
}
public DirectoryClean() {
this.this();
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
private static class Node {
private BIFileStore store;
private String name;
private Node parent;
private TreeMap childByName;
private int status;
public Node makeChild(String string) {
Node node = (Node)this.childByName.get(string);
if (node == null) {
node = new Node(this, string);
this.childByName.put(string, node);
}
return node;
}
public void setStore(BIFileStore bIFileStore) {
if (this.store == null) {
this.store = bIFileStore;
if (bIFileStore instanceof BDaemonDirectoryStore) {
Array array = ((BDaemonDirectoryStore)bIFileStore).getChildren(BCacheAccessPolicy.lazyFetch, true, true, false);
int n = 0;
while (n < array.size()) {
BIFileStore bIFileStore2 = (BIFileStore)array.get(n);
Node node = this.makeChild(bIFileStore2.getFilePath().getName());
node.setStore(bIFileStore2);
++n;
}
}
}
}
public void addTransferElements(FileTransferMessage fileTransferMessage) {
if (this.status == 32) {
fileTransferMessage.addDelete(this.store.getFilePath());
} else if ((this.status & 0x10) > 0) {
Iterator iterator = this.childByName.values().iterator();
while (iterator.hasNext()) {
((Node)iterator.next()).addTransferElements(fileTransferMessage);
}
}
}
public void dump(String string) {
System.out.print(string);
System.out.print(this.name);
System.out.print(" ");
if (this.status == 0) {
System.out.print("unknown ");
}
if ((this.status & 1) > 0) {
System.out.print("keepSome ");
}
if ((this.status & 2) > 0) {
System.out.print("keepAll ");
}
if ((this.status & 0x10) > 0) {
System.out.print("cleanSome ");
}
if ((this.status & 0x20) > 0) {
System.out.print("cleanAll ");
}
System.out.println();
Iterator iterator = this.childByName.values().iterator();
while (iterator.hasNext()) {
((Node)iterator.next()).dump(string + this.name + '/');
}
}
public void transition(int n) {
this.transition(n, 17);
}
private final void transition(int n, int n2) {
if (n == this.status || this.status == 2) {
return;
}
if (n == 0) {
throw new IllegalArgumentException("Can't transition to unknown");
}
if (n == 2) {
this.status = 2;
this.transitionParent(1, n2);
this.transitionChildren(2, n2);
} else if (n == 1) {
if (this.status == 0) {
this.status = 1;
this.transitionParent(1, n2);
} else if (this.status == 32 || this.status == 16) {
this.status = 17;
this.transitionParent(1, n2);
}
} else if (n == 16) {
if (this.status == 0) {
this.status = 16;
this.transitionParent(16, n2);
} else if (this.status == 1) {
this.status = 17;
this.transitionParent(16, n2);
}
} else if (n == 32) {
if (this.status == 0) {
this.status = 32;
this.transitionChildren(32, n2);
this.transitionParent(16, n2);
} else if ((this.status & 1) > 0) {
this.status |= 0x10;
this.transitionChildren(32, n2);
this.transitionParent(16, n2);
} else if (this.status == 16) {
this.transitionChildren(32, n2);
}
}
}
private final void transitionParent(int n, int n2) {
if ((n2 & 1) > 0 && this.parent != null) {
this.parent.transition(n, n2 & 0xFFFFFFEF);
}
}
private final void transitionChildren(int n, int n2) {
if ((n2 & 0x10) > 0) {
Iterator iterator = this.childByName.values().iterator();
while (iterator.hasNext()) {
((Node)iterator.next()).transition(n, n2 & 0xFFFFFFFE);
}
}
}
private final /* synthetic */ void this() {
this.childByName = new TreeMap();
this.status = 0;
}
public Node(Node node, String string) {
this.this();
this.parent = node;
this.name = string;
}
}
}
@@ -0,0 +1,180 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.file.BDirectory
* javax.baja.file.BFileSystem
* javax.baja.file.BIDirectory
* javax.baja.file.BIFile
* javax.baja.file.FilePath
* javax.baja.nre.util.Array
* javax.baja.sys.BObject
* javax.baja.sys.Context
* javax.baja.sys.Cursor
*/
package com.tridium.platform.daemon.file;
import com.tridium.platform.daemon.file.FilePathComparator;
import java.io.IOException;
import java.util.Comparator;
import javax.baja.file.BDirectory;
import javax.baja.file.BFileSystem;
import javax.baja.file.BIDirectory;
import javax.baja.file.BIFile;
import javax.baja.file.FilePath;
import javax.baja.nre.util.Array;
import javax.baja.sys.BObject;
import javax.baja.sys.Context;
import javax.baja.sys.Cursor;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class DirectoryCursor
implements Cursor {
private Array dirContents;
private int carat;
private Object current;
static /* synthetic */ Class class$javax$baja$sys$BComponent;
static /* synthetic */ Class class$javax$baja$file$BIDirectory;
public Context getContext() {
return null;
}
public boolean next() {
if (this.carat < 0) {
this.carat = 0;
} else if (this.current != null && this.current instanceof DirectoryCursor) {
DirectoryCursor directoryCursor = (DirectoryCursor)this.current;
if (!directoryCursor.next()) {
this.current = (BIFile)this.dirContents.get(this.carat);
++this.carat;
}
return true;
}
if (this.carat < this.dirContents.size()) {
if (this.dirContents.get(this.carat) instanceof BIDirectory) {
DirectoryCursor directoryCursor = new DirectoryCursor((BIDirectory)this.dirContents.get(this.carat));
if (directoryCursor.next()) {
this.current = directoryCursor;
} else {
this.current = (BIFile)this.dirContents.get(this.carat);
++this.carat;
}
return true;
}
this.current = (BIFile)this.dirContents.get(this.carat);
++this.carat;
return true;
}
this.current = null;
return false;
}
public boolean nextComponent() {
Class clazz = class$javax$baja$sys$BComponent;
if (clazz == null) {
clazz = class$javax$baja$sys$BComponent = DirectoryCursor.class("[Ljavax.baja.sys.BComponent;", false);
}
return this.next(clazz);
}
public boolean next(Class clazz) {
boolean bl = this.next();
while (bl && !clazz.isAssignableFrom(this.get().getClass())) {
bl = this.next();
}
return bl;
}
public boolean nextNonDirectory() {
boolean bl = this.next();
while (bl && this.getFile() instanceof BDirectory) {
bl = this.next();
}
return bl;
}
public BObject get() {
if (this.current != null && this.current instanceof DirectoryCursor) {
return ((DirectoryCursor)this.current).get();
}
return (BObject)this.current;
}
public BIFile getFile() {
return (BIFile)this.get();
}
/*
* Unable to fully structure code
*/
public static void main(String[] var0) {
try {
BFileSystem.INSTANCE.makeDir(new FilePath("^testCursor"));
BFileSystem.INSTANCE.makeDir(new FilePath("^testCursor/0"));
BFileSystem.INSTANCE.makeDir(new FilePath("^testCursor/0/0.0"));
BFileSystem.INSTANCE.makeDir(new FilePath("^testCursor/1"));
BFileSystem.INSTANCE.makeFile(new FilePath("^testCursor/a.txt"));
BFileSystem.INSTANCE.makeFile(new FilePath("^testCursor/0/0a.txt"));
BFileSystem.INSTANCE.makeFile(new FilePath("^testCursor/0/0b.txt"));
BFileSystem.INSTANCE.makeFile(new FilePath("^testCursor/0/0.0/0.0a.txt"));
BFileSystem.INSTANCE.makeFile(new FilePath("^testCursor/0/0.0/0.0b.txt"));
var1_1 = (BIDirectory)BFileSystem.INSTANCE.findFile(new FilePath("^testcursor"));
System.out.println("full iteration");
var2_3 = new DirectoryCursor(var1_1);
while (var2_3.next()) {
var3_4 = (BIFile)var2_3.get();
System.out.println(" " + var3_4.getFilePath().getBody());
}
System.out.println("directories only");
var2_3 = new DirectoryCursor(var1_1);
if (true) ** GOTO lbl33
do {
var3_4 = (BIFile)var2_3.get();
System.out.println(" " + var3_4.getFilePath().getBody());
lbl33:
// 2 sources
if ((v0 = DirectoryCursor.class$javax$baja$file$BIDirectory) != null) continue;
v0 = DirectoryCursor.class("[Ljavax.baja.file.BIDirectory;", false);
} while (var2_3.next(v0));
}
catch (IOException var1_2) {
var1_2.printStackTrace();
}
System.exit(0);
}
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.carat = -1;
this.current = null;
}
public DirectoryCursor(BIDirectory bIDirectory) {
this.this();
this.dirContents = new Array((Object[])bIDirectory.listFiles()).sort(new Comparator(){
public final int compare(Object object, Object object2) {
BIFile bIFile = (BIFile)object;
BIFile bIFile2 = (BIFile)object2;
return FilePathComparator.INSTANCE.compare(bIFile.getFilePath(), bIFile2.getFilePath());
}
});
}
}
@@ -0,0 +1,119 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.file.BFileSpace
* javax.baja.file.BIFile
* javax.baja.file.BIFileStore
* javax.baja.file.FilePath
*/
package com.tridium.platform.daemon.file;
import com.tridium.platform.daemon.DaemonFileUtil;
import com.tridium.platform.daemon.file.FilePathComparator;
import com.tridium.platform.daemon.file.StoreCache;
import java.util.Collection;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import javax.baja.file.BFileSpace;
import javax.baja.file.BIFile;
import javax.baja.file.BIFileStore;
import javax.baja.file.FilePath;
public class FileCache
extends StoreCache {
public static final int FOUND = 0;
public static final int NOT_FOUND = 1;
public static final int UNKNOWN = 2;
private TreeSet pathsNotFound = new TreeSet(FilePathComparator.INSTANCE);
private TreeMap fileByPath = new TreeMap(FilePathComparator.INSTANCE);
private TreeSet completedPaths = new TreeSet(FilePathComparator.INSTANCE);
private BFileSpace space;
public int getCacheStatus(FilePath filePath) {
if (this.pathsNotFound.contains(filePath)) {
return 1;
}
if (this.fileByPath.containsKey(filePath)) {
return 0;
}
if (this.completedPaths.contains(filePath.getParent())) {
return 1;
}
return 2;
}
public BIFile getFile(FilePath filePath) {
return (BIFile)this.fileByPath.get(filePath);
}
public BIFileStore getStore(FilePath filePath) {
BIFile bIFile = this.getFile(filePath);
return bIFile == null ? null : bIFile.getStore();
}
public Collection getCachedFiles() {
return this.fileByPath.values();
}
public Set getCachedFilePaths() {
return this.fileByPath.keySet();
}
public void cacheResult(BIFileStore bIFileStore) {
this.cacheResult(this.space.makeFile(bIFileStore));
}
public void cacheResult(BIFile bIFile) {
this.fileByPath.put(bIFile.getFilePath(), bIFile);
}
public void cacheNotFound(FilePath filePath) {
this.pathsNotFound.add(filePath);
}
public void cacheCompleted(FilePath filePath) {
this.completedPaths.add(filePath);
}
public void clear() {
this.pathsNotFound.clear();
this.fileByPath.clear();
this.completedPaths.clear();
}
public void clear(FilePath filePath) {
Object object;
Object object2;
TreeSet<Object> treeSet = new TreeSet<Object>(FilePathComparator.INSTANCE);
Object object3 = this.pathsNotFound.iterator();
while (object3.hasNext()) {
object2 = new FilePath((String)object3.next());
if (DaemonFileUtil.isSubPath((FilePath)object2, filePath)) continue;
treeSet.add(object2);
}
object3 = new TreeMap(FilePathComparator.INSTANCE);
object2 = this.fileByPath.keySet().iterator();
while (object2.hasNext()) {
object = (FilePath)object2.next();
if (DaemonFileUtil.isSubPath((FilePath)object, filePath)) continue;
((TreeMap)object3).put(object, this.fileByPath.get(object));
}
object2 = new TreeSet(FilePathComparator.INSTANCE);
object = this.completedPaths.iterator();
while (object.hasNext()) {
FilePath filePath2 = (FilePath)object.next();
if (DaemonFileUtil.isSubPath(filePath2, filePath)) continue;
((TreeSet)object2).add(filePath2);
}
this.pathsNotFound = treeSet;
this.fileByPath = object3;
this.completedPaths = object2;
}
public FileCache(BFileSpace bFileSpace) {
this.space = bFileSpace;
}
}
@@ -0,0 +1,79 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.sys.BAbsTime
*/
package com.tridium.platform.daemon.file;
import javax.baja.sys.BAbsTime;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class FileHeaderInfo {
private String contentType;
private long contentLength;
private BAbsTime lastModified;
private long crc;
public void setContentType(String string) {
this.contentType = string;
}
public void setContentLength(long l) {
this.contentLength = l;
}
public void setLastModified(BAbsTime bAbsTime) {
this.lastModified = bAbsTime;
}
public void setCrc(long l) {
this.crc = l;
}
public String getContentType() {
return this.contentType;
}
public boolean isDirectory() {
return this.contentType.equalsIgnoreCase("application/x-baja-directory");
}
public long getContentLength() {
return this.contentLength;
}
public BAbsTime getLastModified() {
return this.lastModified;
}
public long getCrc() {
return this.crc;
}
private final /* synthetic */ void this() {
this.contentType = null;
this.contentLength = -1;
this.lastModified = BAbsTime.NULL;
this.crc = -1;
}
public FileHeaderInfo(String string, long l, BAbsTime bAbsTime) {
this(string, l, bAbsTime, -1);
}
public FileHeaderInfo(String string, long l, BAbsTime bAbsTime, long l2) {
this.this();
this.setContentType(string);
this.setContentLength(l);
this.setLastModified(bAbsTime);
this.setCrc(l2);
}
public FileHeaderInfo() {
this.this();
}
}
@@ -0,0 +1,33 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.file.FilePath
*/
package com.tridium.platform.daemon.file;
import java.util.Comparator;
import javax.baja.file.FilePath;
public class FilePathComparator
implements Comparator {
public static FilePathComparator INSTANCE = new FilePathComparator();
public int compare(Object object, Object object2) {
FilePath filePath = (FilePath)object;
FilePath filePath2 = (FilePath)object2;
return filePath.getBody().compareTo(filePath2.getBody());
}
public boolean equals(Object object) {
boolean bl = false;
if (object == this) {
bl = true;
}
return bl;
}
private FilePathComparator() {
}
}
@@ -0,0 +1,108 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.file.BIFileStore
* javax.baja.file.FilePath
*/
package com.tridium.platform.daemon.file;
import com.tridium.platform.daemon.DaemonFileUtil;
import com.tridium.platform.daemon.file.FilePathComparator;
import java.util.Iterator;
import java.util.TreeMap;
import java.util.TreeSet;
import javax.baja.file.BIFileStore;
import javax.baja.file.FilePath;
public class StoreCache {
public static final int FOUND = 0;
public static final int NOT_FOUND = 1;
public static final int UNKNOWN = 2;
private TreeSet pathsNotFound = new TreeSet(FilePathComparator.INSTANCE);
private TreeMap storeByPath = new TreeMap(FilePathComparator.INSTANCE);
private TreeSet completedPaths = new TreeSet(FilePathComparator.INSTANCE);
public int getCacheStatus(FilePath filePath) {
if (this.pathsNotFound.contains(filePath)) {
return 1;
}
if (this.storeByPath.containsKey(filePath)) {
return 0;
}
if (filePath.getParent() != null && this.completedPaths.contains(filePath.getParent())) {
return 1;
}
return 2;
}
public BIFileStore getStore(FilePath filePath) {
return (BIFileStore)this.storeByPath.get(filePath);
}
public void cacheResult(BIFileStore bIFileStore) {
this.storeByPath.put(bIFileStore.getFilePath(), bIFileStore);
}
public void cacheNotFound(FilePath filePath) {
this.pathsNotFound.add(filePath);
}
public void cacheCompleted(FilePath filePath) {
this.completedPaths.add(filePath);
}
public void clear() {
this.pathsNotFound.clear();
this.storeByPath.clear();
this.completedPaths.clear();
}
public void clear(FilePath filePath) {
Object object;
Object object2;
TreeSet<Object> treeSet = new TreeSet<Object>(FilePathComparator.INSTANCE);
Object object3 = this.pathsNotFound.iterator();
while (object3.hasNext()) {
object2 = (FilePath)object3.next();
if (DaemonFileUtil.isSubPath((FilePath)object2, filePath)) continue;
treeSet.add(object2);
}
object3 = new TreeMap(FilePathComparator.INSTANCE);
object2 = this.storeByPath.keySet().iterator();
while (object2.hasNext()) {
object = (FilePath)object2.next();
if (DaemonFileUtil.isSubPath((FilePath)object, filePath)) continue;
((TreeMap)object3).put(object, this.storeByPath.get(object));
}
object2 = new TreeSet(FilePathComparator.INSTANCE);
object = this.completedPaths.iterator();
while (object.hasNext()) {
FilePath filePath2 = (FilePath)object.next();
if (DaemonFileUtil.isSubPath(filePath2, filePath)) continue;
((TreeSet)object2).add(filePath2);
}
this.pathsNotFound = treeSet;
this.storeByPath = object3;
this.completedPaths = object2;
}
public void dump() {
System.out.println("cached not found:");
Iterator<Object> iterator = this.pathsNotFound.iterator();
while (iterator.hasNext()) {
System.out.println(" " + iterator.next());
}
System.out.println("cached stores:");
iterator = this.storeByPath.keySet().iterator();
while (iterator.hasNext()) {
System.out.println(" " + iterator.next());
}
System.out.println("cached completed:");
iterator = this.completedPaths.iterator();
while (iterator.hasNext()) {
System.out.println(" " + iterator.next());
}
}
}
@@ -0,0 +1,33 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.file.FilePath
*/
package com.tridium.platform.daemon.message;
import com.tridium.platform.daemon.file.BDaemonFileSpace;
import com.tridium.platform.daemon.message.FileTransferMessageElement;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import javax.baja.file.FilePath;
public class ByteArrayFileTransferElement
extends FileTransferMessageElement {
private byte[] bytes;
public InputStream getStream() throws IOException {
return new ByteArrayInputStream(this.bytes);
}
public long getSize() {
return this.bytes.length;
}
public ByteArrayFileTransferElement(FilePath filePath, byte[] byArray, BDaemonFileSpace bDaemonFileSpace) {
super(filePath, bDaemonFileSpace);
this.bytes = byArray;
}
}
@@ -0,0 +1,24 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platform.daemon.message;
import com.tridium.platform.daemon.message.XmlResponseMessage;
public class DaemonDebugMessage
extends XmlResponseMessage {
String messageString;
public String getMessageString() {
return this.messageString;
}
public DaemonDebugMessage() {
this.messageString = "debug";
}
public DaemonDebugMessage(boolean bl) {
this.messageString = "debug?update=true&daemonDebug=" + bl;
}
}
@@ -0,0 +1,22 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platform.daemon.message;
import java.io.OutputStream;
public abstract class DaemonMessage {
public abstract String getMessageString();
public void write(OutputStream outputStream) {
}
public String getMethod() {
return "GET";
}
public int getConnectionFlags() {
return 0;
}
}
@@ -0,0 +1,26 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.net.HttpUtil
*/
package com.tridium.platform.daemon.message;
import com.tridium.net.HttpUtil;
import com.tridium.platform.daemon.message.XmlResponseMessage;
public class DeleteAppMessage
extends XmlResponseMessage {
private StringBuffer path;
public String getMessageString() {
return this.path.toString();
}
public DeleteAppMessage(String string, String string2) {
this.path = new StringBuffer(string);
this.path.append("?action=delete");
this.path.append('&').append(string).append('=').append(HttpUtil.encodeUrl((String)string2));
}
}
@@ -0,0 +1,60 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.file.FilePath
*/
package com.tridium.platform.daemon.message;
import com.tridium.platform.daemon.file.BDaemonFileSpace;
import com.tridium.platform.daemon.message.FileTransferMessageElement;
import java.util.Set;
import javax.baja.file.FilePath;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class DeleteFileTransferMessageElement
extends FileTransferMessageElement {
int completed;
public String getRequestMethod() {
return "DELETE";
}
public long getSize() {
return 0L;
}
public void initProgress() {
this.completed = 0;
}
public void updateProgress(int n) {
this.completed = 100;
}
public int getProgress() {
return this.completed;
}
public void updateTransferInfo(Set set, Set set2) {
if (!set2.contains(this.getFilePath())) {
set.add(this.getFilePath());
}
}
protected String getProgressLexiconKey() {
return "DeleteFileTransferMessageElement.progress";
}
private final /* synthetic */ void this() {
this.completed = 0;
}
public DeleteFileTransferMessageElement(FilePath filePath, BDaemonFileSpace bDaemonFileSpace) {
super(filePath, bDaemonFileSpace);
this.this();
}
}
@@ -0,0 +1,14 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platform.daemon.message;
import com.tridium.platform.daemon.message.DeleteAppMessage;
public class DeleteR2StationMessage
extends DeleteAppMessage {
public DeleteR2StationMessage(String string) {
super("r2station", string);
}
}
@@ -0,0 +1,14 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platform.daemon.message;
import com.tridium.platform.daemon.message.DeleteAppMessage;
public class DeleteStationMessage
extends DeleteAppMessage {
public DeleteStationMessage(String string) {
super("station", string);
}
}
@@ -0,0 +1,38 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.file.BIFile
* javax.baja.file.FilePath
*/
package com.tridium.platform.daemon.message;
import com.tridium.platform.daemon.file.BDaemonFileSpace;
import com.tridium.platform.daemon.message.FileTransferMessageElement;
import java.io.IOException;
import java.io.InputStream;
import javax.baja.file.BIFile;
import javax.baja.file.FilePath;
public class FileFileTransferElement
extends FileTransferMessageElement {
private BIFile file;
public InputStream getStream() throws IOException {
return this.file.getInputStream();
}
public long getSize() {
return this.file.getSize();
}
public FileFileTransferElement(BIFile bIFile, BDaemonFileSpace bDaemonFileSpace) {
this(bIFile.getFilePath(), bIFile, bDaemonFileSpace);
}
public FileFileTransferElement(FilePath filePath, BIFile bIFile, BDaemonFileSpace bDaemonFileSpace) {
super(filePath, bDaemonFileSpace);
this.file = bIFile;
}
}
@@ -0,0 +1,35 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.file.FilePath
*/
package com.tridium.platform.daemon.message;
import com.tridium.platform.daemon.file.BDaemonFileSpace;
import com.tridium.platform.daemon.message.DaemonMessage;
import javax.baja.file.FilePath;
public class FileHeaderMessage
extends DaemonMessage {
private StringBuffer path;
public String getMessageString() {
return this.path.toString();
}
public String getMethod() {
return "HEAD";
}
public FileHeaderMessage(FilePath filePath, BDaemonFileSpace bDaemonFileSpace) {
this(filePath, bDaemonFileSpace, false);
}
public FileHeaderMessage(FilePath filePath, BDaemonFileSpace bDaemonFileSpace, boolean bl) {
this.path = new StringBuffer(bDaemonFileSpace.filePathToUri(filePath));
this.path.append("?sendCrc=");
this.path.append(bl);
}
}
@@ -0,0 +1,298 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.file.BIFile
* javax.baja.file.FilePath
* javax.baja.nre.util.Array
* javax.baja.security.AuthenticationException
* javax.baja.sys.BajaRuntimeException
*/
package com.tridium.platform.daemon.message;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.file.BDaemonFileSpace;
import com.tridium.platform.daemon.file.FilePathComparator;
import com.tridium.platform.daemon.file.StoreCache;
import com.tridium.platform.daemon.message.DeleteFileTransferMessageElement;
import com.tridium.platform.daemon.message.FileFileTransferElement;
import com.tridium.platform.daemon.message.FileTransferMessageElement;
import com.tridium.platform.daemon.message.MkDirFileTransferMessageElement;
import com.tridium.platform.daemon.message.RenameFileTransferMessageElement;
import java.io.IOException;
import java.io.InputStream;
import java.net.ConnectException;
import java.util.Comparator;
import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;
import javax.baja.file.BIFile;
import javax.baja.file.FilePath;
import javax.baja.nre.util.Array;
import javax.baja.security.AuthenticationException;
import javax.baja.sys.BajaRuntimeException;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class FileTransferMessage {
private Map deletesByFilePath;
private Array posts;
private boolean autoCommit;
private String transactionId;
private long transferTotal;
private long transferComplete;
private StoreCache cache;
private BDaemonFileSpace fileSpace;
static /* synthetic */ Class class$com$tridium$platform$daemon$message$FileTransferMessageElement;
static /* synthetic */ Class class$javax$baja$file$FilePath;
public static FileTransferMessage make(BIFile bIFile, BDaemonFileSpace bDaemonFileSpace) throws IOException {
FileTransferMessage fileTransferMessage = new FileTransferMessage(bDaemonFileSpace);
fileTransferMessage.addFile(bIFile);
return fileTransferMessage;
}
public static FileTransferMessage make(BIFile bIFile, FilePath filePath, BDaemonFileSpace bDaemonFileSpace) throws IOException {
FileTransferMessage fileTransferMessage = new FileTransferMessage(bDaemonFileSpace);
fileTransferMessage.addFile(bIFile, filePath);
return fileTransferMessage;
}
public static FileTransferMessage makeDelete(FilePath filePath, BDaemonFileSpace bDaemonFileSpace) {
FileTransferMessage fileTransferMessage = new FileTransferMessage(bDaemonFileSpace);
fileTransferMessage.addElement(new DeleteFileTransferMessageElement(filePath, bDaemonFileSpace));
return fileTransferMessage;
}
public static FileTransferMessage makeMkDir(FilePath filePath, BDaemonFileSpace bDaemonFileSpace) {
FileTransferMessage fileTransferMessage = new FileTransferMessage(bDaemonFileSpace);
fileTransferMessage.addElement(new MkDirFileTransferMessageElement(filePath, bDaemonFileSpace));
return fileTransferMessage;
}
public static FileTransferMessage makeRename(FilePath filePath, String string, BDaemonFileSpace bDaemonFileSpace) {
FileTransferMessage fileTransferMessage = new FileTransferMessage(bDaemonFileSpace);
fileTransferMessage.addElement(new RenameFileTransferMessageElement(filePath, string, bDaemonFileSpace));
return fileTransferMessage;
}
public StoreCache getCache() {
return this.cache;
}
public void addElement(InputStream inputStream, FilePath filePath, long l) {
this.addElement(new FileTransferMessageElement(filePath, inputStream, l, this.fileSpace));
}
public void addFile(BIFile bIFile, FilePath filePath) throws IOException {
this.addElement(new FileFileTransferElement(filePath, bIFile, this.fileSpace));
}
public void addElement(FileTransferMessageElement fileTransferMessageElement) {
if (fileTransferMessageElement.getRequestMethod().equals("DELETE")) {
FilePath filePath = fileTransferMessageElement.getFilePath();
while (filePath != null) {
if (this.deletesByFilePath.containsKey(filePath)) {
return;
}
filePath = filePath.getParent();
}
Class clazz = class$javax$baja$file$FilePath;
if (clazz == null) {
clazz = class$javax$baja$file$FilePath = FileTransferMessage.class("[Ljavax.baja.file.FilePath;", false);
}
Array array = new Array(clazz);
String string = fileTransferMessageElement.getFilePath().getBody() + '/';
Iterator iterator = this.deletesByFilePath.keySet().iterator();
while (iterator.hasNext()) {
FilePath filePath2 = (FilePath)iterator.next();
if (!filePath2.getBody().startsWith(string)) continue;
array.add((Object)filePath2);
}
int n = 0;
while (n < array.size()) {
this.deletesByFilePath.remove(array.get(n));
++n;
}
this.deletesByFilePath.put(fileTransferMessageElement.getFilePath(), fileTransferMessageElement);
} else {
this.posts.add((Object)fileTransferMessageElement);
}
}
public void addDelete(FilePath filePath) {
this.addElement(new DeleteFileTransferMessageElement(filePath, this.fileSpace));
}
public void addFile(BIFile bIFile) throws IOException {
this.addFile(bIFile, bIFile.getFilePath());
}
public String getCommitUri() {
if (this.autoCommit || this.transactionId == null) {
return null;
}
return "/niagara/?transaction=commit&transactionId=" + this.transactionId;
}
public String getAbortUri() {
if (this.autoCommit || this.transactionId == null) {
return null;
}
return "/niagara/?transaction=abort&transactionId=" + this.transactionId;
}
public boolean isAutoCommit() {
return this.autoCommit;
}
public BDaemonFileSpace getTargetFileSpace() {
return this.fileSpace;
}
public Array getElements(BDaemonSession bDaemonSession) throws ConnectException, AuthenticationException {
try {
Class clazz = class$com$tridium$platform$daemon$message$FileTransferMessageElement;
if (clazz == null) {
clazz = class$com$tridium$platform$daemon$message$FileTransferMessageElement = FileTransferMessage.class("[Lcom.tridium.platform.daemon.message.FileTransferMessageElement;", false);
}
Array array = new Array(clazz);
array.addAll(this.deletesByFilePath.values());
array.addAll(this.posts);
return array.sort((Comparator)new ElementComparator(bDaemonSession));
}
catch (BajaRuntimeException bajaRuntimeException) {
Throwable throwable = bajaRuntimeException.getCause();
if (throwable instanceof ConnectException) {
throw (ConnectException)throwable;
}
if (throwable instanceof AuthenticationException) {
throw (AuthenticationException)throwable;
}
throw bajaRuntimeException;
}
}
public void setTransactionId(String string) {
this.transactionId = string;
}
public String getTransactionId() {
return this.transactionId;
}
public void initProgress() {
this.transferTotal = 0L;
this.transferComplete = 0L;
int n = 0;
while (n < this.posts.size()) {
FileTransferMessageElement fileTransferMessageElement = (FileTransferMessageElement)this.posts.get(n);
this.transferTotal += fileTransferMessageElement.getSize();
fileTransferMessageElement.initProgress();
++n;
}
}
public void updateProgress(FileTransferMessageElement fileTransferMessageElement, int n) {
fileTransferMessageElement.updateProgress(n);
this.transferComplete += (long)n;
}
public int getProgress() {
return this.transferTotal == 0L ? 100 : (int)(100.0 * (double)this.transferComplete / (double)this.transferTotal);
}
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.transactionId = null;
this.transferTotal = 0L;
this.transferComplete = 0L;
}
public FileTransferMessage(StoreCache storeCache, BDaemonFileSpace bDaemonFileSpace) {
this(false, storeCache, bDaemonFileSpace);
}
public FileTransferMessage(BDaemonFileSpace bDaemonFileSpace) {
this(false, bDaemonFileSpace);
}
public FileTransferMessage(boolean bl, BDaemonFileSpace bDaemonFileSpace) {
this(bl, new StoreCache(), bDaemonFileSpace);
}
public FileTransferMessage(boolean bl, StoreCache storeCache, BDaemonFileSpace bDaemonFileSpace) {
this.this();
this.autoCommit = bl;
this.deletesByFilePath = new TreeMap(FilePathComparator.INSTANCE);
Class clazz = class$com$tridium$platform$daemon$message$FileTransferMessageElement;
if (clazz == null) {
clazz = class$com$tridium$platform$daemon$message$FileTransferMessageElement = FileTransferMessage.class("[Lcom.tridium.platform.daemon.message.FileTransferMessageElement;", false);
}
this.posts = new Array(clazz);
this.cache = storeCache;
this.fileSpace = bDaemonFileSpace;
}
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
private class ElementComparator
implements Comparator {
private BDaemonSession session;
public int compare(Object object, Object object2) {
try {
FileTransferMessageElement fileTransferMessageElement = (FileTransferMessageElement)object;
FileTransferMessageElement fileTransferMessageElement2 = (FileTransferMessageElement)object2;
if (fileTransferMessageElement.getRequestMethod().equals(fileTransferMessageElement2.getRequestMethod())) {
long l;
long l2 = fileTransferMessageElement.getSizeDelta(this.session, FileTransferMessage.this);
if (l2 == (l = fileTransferMessageElement.getSizeDelta(this.session, FileTransferMessage.this))) {
return fileTransferMessageElement.getUri().compareTo(fileTransferMessageElement2.getUri());
}
if (l2 < l) {
return -1;
}
return 1;
}
if (fileTransferMessageElement.getRequestMethod().equals("DELETE")) {
return -1;
}
return 1;
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new BajaRuntimeException((Throwable)exception);
}
}
public boolean equals(Object object) {
boolean bl = false;
if (object == this) {
bl = true;
}
return bl;
}
public ElementComparator(BDaemonSession bDaemonSession) {
this.session = bDaemonSession;
}
}
}
@@ -0,0 +1,165 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.net.HttpUtil
* javax.baja.file.BIFileStore
* javax.baja.file.FilePath
* javax.baja.security.AuthenticationException
* javax.baja.sys.BIcon
* javax.baja.sys.Sys
* javax.baja.util.Lexicon
*/
package com.tridium.platform.daemon.message;
import com.tridium.net.HttpUtil;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.file.BDaemonDirectoryStore;
import com.tridium.platform.daemon.file.BDaemonFileSpace;
import com.tridium.platform.daemon.message.FileTransferMessage;
import java.io.IOException;
import java.io.InputStream;
import java.net.ConnectException;
import java.util.Set;
import javax.baja.file.BIFileStore;
import javax.baja.file.FilePath;
import javax.baja.security.AuthenticationException;
import javax.baja.sys.BIcon;
import javax.baja.sys.Sys;
import javax.baja.util.Lexicon;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class FileTransferMessageElement {
private static final BIcon icon = BIcon.std((String)"file.png");
private static final Lexicon lex = Sys.loadModule((String)"platform").getLexicon();
private InputStream stream;
private long size;
private long existingSize;
private String shortUri;
private long transferTotal;
private long transferComplete;
private FilePath path;
private BDaemonFileSpace space;
public String getRequestMethod() {
return "POST";
}
public String getFullUri(FileTransferMessage fileTransferMessage, boolean bl) {
StringBuffer stringBuffer = new StringBuffer(this.getUri());
if (fileTransferMessage.isAutoCommit()) {
stringBuffer.append("?transaction=standalone");
} else if (bl) {
stringBuffer.append("?transaction=new");
} else {
if (fileTransferMessage.getTransactionId() == null) {
throw new IllegalStateException("program error: missing transaction id");
}
stringBuffer.append("?transaction=current&transactionId=");
stringBuffer.append(fileTransferMessage.getTransactionId());
}
return stringBuffer.toString();
}
public String getUri() {
return this.shortUri;
}
public FilePath getFilePath() {
return this.path;
}
public InputStream getStream() throws IOException {
return this.stream;
}
protected BDaemonFileSpace getDaemonFileSpace() {
return this.space;
}
public long getSize() {
return this.size;
}
public void initProgress() {
this.transferComplete = 0L;
this.transferTotal = this.getSize();
}
public void updateProgress(int n) {
this.transferComplete += (long)n;
}
public int getProgress() {
return this.transferTotal == 0L ? 100 : (int)(100.0 * (double)this.transferComplete / (double)this.transferTotal);
}
public void updateTransferInfo(Set set, Set set2) {
set.remove(this.getFilePath());
set2.add(this.getFilePath());
}
public BIcon getIcon() {
return icon;
}
public String toString() {
return this.getRequestMethod() + ' ' + this.getUri();
}
protected String getProgressLexiconKey() {
return "FileTransferMessageElement.progress";
}
public String getProgressText() {
return lex.getText(this.getProgressLexiconKey(), new Object[]{HttpUtil.decodeUrl((String)this.getUri())});
}
public long getSizeDelta(BDaemonSession bDaemonSession, FileTransferMessage fileTransferMessage) throws AuthenticationException, ConnectException {
return this.getSize() - this.getExistingSize(bDaemonSession, fileTransferMessage);
}
public long getExistingSize(BDaemonSession bDaemonSession, FileTransferMessage fileTransferMessage) throws AuthenticationException, ConnectException {
if (this.existingSize == (long)-1) {
Object object;
int n = fileTransferMessage.getCache().getCacheStatus(this.getFilePath());
if (n == 0) {
object = fileTransferMessage.getCache().getStore(this.getFilePath());
this.existingSize = object.isDirectory() ? 0L : object.getSize();
} else if (n == 1) {
this.existingSize = 0L;
}
if (this.existingSize < 0L) {
object = BDaemonDirectoryStore.make(bDaemonSession.getFileSpace(), this.getFilePath().getParent(), fileTransferMessage.getCache());
if (object == null) {
fileTransferMessage.getCache().cacheNotFound(this.getFilePath());
this.existingSize = 0L;
} else {
BIFileStore bIFileStore = object.getChild(this.getFilePath().getName());
this.existingSize = bIFileStore == null ? 0L : bIFileStore.getSize();
}
}
}
return this.existingSize;
}
private final /* synthetic */ void this() {
this.existingSize = -1;
}
protected FileTransferMessageElement(FilePath filePath, BDaemonFileSpace bDaemonFileSpace) {
this.this();
this.shortUri = bDaemonFileSpace.filePathToUri(filePath);
this.path = filePath;
this.space = bDaemonFileSpace;
}
public FileTransferMessageElement(FilePath filePath, InputStream inputStream, long l, BDaemonFileSpace bDaemonFileSpace) {
this(filePath, bDaemonFileSpace);
this.stream = inputStream;
this.size = l;
}
}
@@ -0,0 +1,27 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platform.daemon.message;
import com.tridium.platform.daemon.message.XmlResponseMessage;
public class GetAppListMessage
extends XmlResponseMessage {
private String appType;
public String getMessageString() {
if (this.appType == null) {
return "applist";
}
return this.appType + "?action=list";
}
public GetAppListMessage() {
this(null);
}
public GetAppListMessage(String string) {
this.appType = string;
}
}
@@ -0,0 +1,35 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.file.FilePath
*/
package com.tridium.platform.daemon.message;
import com.tridium.platform.daemon.file.BDaemonFileSpace;
import com.tridium.platform.daemon.message.DaemonMessage;
import javax.baja.file.FilePath;
public class GetDirectoryMessage
extends DaemonMessage {
private StringBuffer path = new StringBuffer();
public String getMessageString() {
return this.path.toString();
}
public GetDirectoryMessage(FilePath filePath, BDaemonFileSpace bDaemonFileSpace) {
this(filePath, true, false, false, bDaemonFileSpace);
}
public GetDirectoryMessage(FilePath filePath, boolean bl, boolean bl2, boolean bl3, BDaemonFileSpace bDaemonFileSpace) {
this.path.append(bDaemonFileSpace.filePathToUri(filePath));
this.path.append("?recurse=");
this.path.append(bl);
this.path.append("&sendCrc=");
this.path.append(bl2);
this.path.append("&sendPath=");
this.path.append(bl3);
}
}
@@ -0,0 +1,25 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.file.FilePath
*/
package com.tridium.platform.daemon.message;
import com.tridium.platform.daemon.file.BDaemonFileSpace;
import com.tridium.platform.daemon.message.DaemonMessage;
import javax.baja.file.FilePath;
public class GetFileMessage
extends DaemonMessage {
private String path;
public String getMessageString() {
return this.path;
}
public GetFileMessage(FilePath filePath, BDaemonFileSpace bDaemonFileSpace) {
this.path = bDaemonFileSpace.filePathToUri(filePath);
}
}
@@ -0,0 +1,41 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.net.HttpUtil
* javax.baja.file.FilePath
*/
package com.tridium.platform.daemon.message;
import com.tridium.net.HttpUtil;
import com.tridium.platform.daemon.message.DaemonMessage;
import javax.baja.file.FilePath;
public class GetJarContentMessage
extends DaemonMessage {
private StringBuffer path;
public String getMessageString() {
return this.path.toString();
}
public GetJarContentMessage(FilePath filePath, FilePath filePath2) {
if (!filePath.isSysHomeAbsolute()) {
throw new IllegalArgumentException("Cannot retrieve jar contents: not system home absolute '" + filePath.getBody() + '\'');
}
this.path = new StringBuffer("/jars/niagara");
int n = 0;
while (n < filePath.depth()) {
this.path.append('/');
this.path.append(HttpUtil.encodeUrl((String)filePath.nameAt(n)));
++n;
}
n = 0;
while (n < filePath2.depth()) {
this.path.append('/');
this.path.append(HttpUtil.encodeUrl((String)filePath2.nameAt(n)));
++n;
}
}
}
@@ -0,0 +1,14 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platform.daemon.message;
import com.tridium.platform.daemon.message.GetAppListMessage;
public class GetStationListMessage
extends GetAppListMessage {
public GetStationListMessage() {
super("station");
}
}
@@ -0,0 +1,23 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platform.daemon.message;
import com.tridium.platform.daemon.message.XmlResponseMessage;
public class GetTimeMessage
extends XmlResponseMessage {
private static GetTimeMessage INSTANCE = new GetTimeMessage();
public String getMessageString() {
return "time";
}
public static GetTimeMessage getInstance() {
return INSTANCE;
}
private GetTimeMessage() {
}
}
@@ -0,0 +1,70 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.file.FilePath
*/
package com.tridium.platform.daemon.message;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.file.BDaemonFileSpace;
import com.tridium.platform.daemon.message.FileTransferMessage;
import com.tridium.platform.daemon.message.FileTransferMessageElement;
import java.util.Set;
import javax.baja.file.FilePath;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class MkDirFileTransferMessageElement
extends FileTransferMessageElement {
int completed;
public String getRequestMethod() {
return "GET";
}
public String getFullUri(FileTransferMessage fileTransferMessage, boolean bl) {
return super.getFullUri(fileTransferMessage, bl) + "&mkdir=true";
}
public long getSize() {
return 0L;
}
public long getSizeDelta(BDaemonSession bDaemonSession, FileTransferMessage fileTransferMessage) {
return 0L;
}
public void initProgress() {
this.completed = 0;
}
public void updateProgress(int n) {
this.completed = 100;
}
public int getProgress() {
return this.completed;
}
public void updateTransferInfo(Set set, Set set2) {
if (!set2.contains(this.getFilePath())) {
set.add(this.getFilePath());
}
}
protected String getProgressLexiconKey() {
return "MkDirFileTransferMessageElement.progress";
}
private final /* synthetic */ void this() {
this.completed = 0;
}
public MkDirFileTransferMessageElement(FilePath filePath, BDaemonFileSpace bDaemonFileSpace) {
super(filePath, bDaemonFileSpace);
this.this();
}
}
@@ -0,0 +1,23 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platform.daemon.message;
import com.tridium.platform.daemon.message.XmlResponseMessage;
public class OSUpdateMessage
extends XmlResponseMessage {
private static OSUpdateMessage instance = new OSUpdateMessage();
public String getMessageString() {
return "osupdate";
}
public static OSUpdateMessage getInstance() {
return instance;
}
private OSUpdateMessage() {
}
}
@@ -0,0 +1,23 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platform.daemon.message;
import com.tridium.platform.daemon.message.XmlResponseMessage;
public class QnxInetdMessage
extends XmlResponseMessage {
private static QnxInetdMessage instance = new QnxInetdMessage();
public String getMessageString() {
return "qnxinetd";
}
public static QnxInetdMessage getInstance() {
return instance;
}
private QnxInetdMessage() {
}
}
@@ -0,0 +1,23 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platform.daemon.message;
import com.tridium.platform.daemon.message.XmlResponseMessage;
public class QnxSshdMessage
extends XmlResponseMessage {
private static QnxSshdMessage instance = new QnxSshdMessage();
public String getMessageString() {
return "qnxsshd";
}
public static QnxSshdMessage getInstance() {
return instance;
}
private QnxSshdMessage() {
}
}
@@ -0,0 +1,23 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platform.daemon.message;
import com.tridium.platform.daemon.message.XmlResponseMessage;
public class RefreshDaemonBinariesMessage
extends XmlResponseMessage {
private static RefreshDaemonBinariesMessage instance = new RefreshDaemonBinariesMessage();
public String getMessageString() {
return "updatedaemon?refreshSoftware=true";
}
public static RefreshDaemonBinariesMessage getInstance() {
return instance;
}
private RefreshDaemonBinariesMessage() {
}
}
@@ -0,0 +1,79 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.net.HttpUtil
* javax.baja.file.FilePath
*/
package com.tridium.platform.daemon.message;
import com.tridium.net.HttpUtil;
import com.tridium.platform.daemon.BDaemonSession;
import com.tridium.platform.daemon.file.BDaemonFileSpace;
import com.tridium.platform.daemon.message.FileTransferMessage;
import com.tridium.platform.daemon.message.FileTransferMessageElement;
import java.util.Set;
import javax.baja.file.FilePath;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class RenameFileTransferMessageElement
extends FileTransferMessageElement {
int completed;
String newName;
public String getRequestMethod() {
return "GET";
}
public String getFullUri(FileTransferMessage fileTransferMessage, boolean bl) {
return super.getFullUri(fileTransferMessage, bl) + "&rename=" + HttpUtil.encodeUrl((String)this.newName);
}
public long getSize() {
return 0L;
}
public long getSizeDelta(BDaemonSession bDaemonSession, FileTransferMessage fileTransferMessage) {
return 0L;
}
public void initProgress() {
this.completed = 0;
}
public void updateProgress(int n) {
this.completed = 100;
}
public int getProgress() {
return this.completed;
}
public void updateTransferInfo(Set set, Set set2) {
FilePath filePath;
if (!set2.contains(this.getFilePath())) {
set.add(this.getFilePath());
}
if (!set.contains(filePath = this.getFilePath().getParent().merge(this.newName))) {
set2.add(filePath);
}
}
protected String getProgressLexiconKey() {
return "RenameFileTransferMessageElement.progress";
}
private final /* synthetic */ void this() {
this.completed = 0;
}
public RenameFileTransferMessageElement(FilePath filePath, String string, BDaemonFileSpace bDaemonFileSpace) {
super(filePath, bDaemonFileSpace);
this.this();
filePath.merge(string);
this.newName = string;
}
}
@@ -0,0 +1,43 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.net.HttpUtil
* javax.baja.sys.Sys
*/
package com.tridium.platform.daemon.message;
import com.tridium.net.HttpUtil;
import com.tridium.platform.daemon.message.XmlResponseMessage;
import javax.baja.sys.Sys;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class ReportStatusMessage
extends XmlResponseMessage {
private StringBuffer path;
public String getMessageString() {
return this.path == null ? null : this.path.toString();
}
private final /* synthetic */ void this() {
this.path = null;
}
public ReportStatusMessage(String[] stringArray, String[] stringArray2) {
this.this();
if (stringArray != null && stringArray2 != null) {
this.path = new StringBuffer("report");
this.path.append("?station=").append(HttpUtil.encodeUrl((String)Sys.getStationHome().getName()));
this.path.append("&displayname=").append(HttpUtil.encodeUrl((String)Sys.getStation().getStationName()));
int n = 0;
while (n < stringArray.length) {
this.path.append("&" + stringArray[n] + '=').append(stringArray2[n]);
++n;
}
}
}
}

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