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,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;
}
}
}
}
@@ -0,0 +1,23 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platform.daemon.message;
import com.tridium.platform.daemon.message.XmlResponseMessage;
public class RequestGarbageCollectionMessage
extends XmlResponseMessage {
private static RequestGarbageCollectionMessage instance = new RequestGarbageCollectionMessage();
public String getMessageString() {
return "updatedaemon?garbageCollection=true";
}
public static RequestGarbageCollectionMessage getInstance() {
return instance;
}
private RequestGarbageCollectionMessage() {
}
}
@@ -0,0 +1,49 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.net.HttpUtil
* com.tridium.nre.util.LegacyStorageUtil
* javax.baja.security.BPassword
*/
package com.tridium.platform.daemon.message;
import com.tridium.net.HttpUtil;
import com.tridium.nre.util.LegacyStorageUtil;
import com.tridium.platform.daemon.message.XmlResponseMessage;
import javax.baja.security.BPassword;
public class SystemPasswordMessageAX
extends XmlResponseMessage {
private String oldPasswordEncoding;
private String newPasswordEncoding;
private boolean checkIfValid;
public String getMessageString() {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("systempwax");
if (this.checkIfValid) {
stringBuffer.append("?check=true");
if (this.oldPasswordEncoding != null) {
stringBuffer.append("&oldSystemPassword=").append(HttpUtil.encodeUrl((String)this.oldPasswordEncoding));
} else if (this.newPasswordEncoding != null) {
stringBuffer.append("&systemPassword=").append(HttpUtil.encodeUrl((String)this.newPasswordEncoding));
}
} else if (this.newPasswordEncoding != null && this.oldPasswordEncoding != null) {
stringBuffer.append("?update=true");
stringBuffer.append("&oldSystemPassword=").append(HttpUtil.encodeUrl((String)this.oldPasswordEncoding));
stringBuffer.append("&systemPassword=").append(HttpUtil.encodeUrl((String)this.newPasswordEncoding));
}
return stringBuffer.toString();
}
public SystemPasswordMessageAX() {
}
public SystemPasswordMessageAX(BPassword bPassword, BPassword bPassword2, boolean bl) throws Exception {
this.oldPasswordEncoding = bPassword2 == null ? null : LegacyStorageUtil.encode((String)bPassword2.getValue());
this.newPasswordEncoding = bPassword == null ? null : LegacyStorageUtil.encode((String)bPassword.getValue());
this.checkIfValid = bl;
}
}
@@ -0,0 +1,36 @@
/*
* 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 UpdateAppMessage
extends XmlResponseMessage {
private StringBuffer path;
public String getMessageString() {
return this.path.toString();
}
public UpdateAppMessage(String string) {
this.path = new StringBuffer(string + "?action=update");
}
public UpdateAppMessage(String string, String string2, boolean bl, boolean bl2, boolean bl3, boolean bl4) {
this.path = new StringBuffer(string);
this.path.append("?action=update");
this.path.append('&').append(string).append('=').append(HttpUtil.encodeUrl((String)string2));
this.path.append("&isdisabled=").append(bl);
this.path.append("&isautostart=").append(bl2);
this.path.append("&isautorestart=").append(bl3);
if (bl4) {
this.path.append("&save=true");
}
}
}
@@ -0,0 +1,30 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platform.daemon.message;
import com.tridium.platform.daemon.message.DaemonMessage;
public class UpdateInetMessage
extends DaemonMessage {
private StringBuffer buf = new StringBuffer("qnxinetd?update=true&fp=");
public String getMessageString() {
return this.buf.toString();
}
public UpdateInetMessage(boolean bl, int n, boolean bl2, int n2) {
if (bl) {
this.buf.append(n);
} else {
this.buf.append("-1");
}
this.buf.append("&tp=");
if (bl2) {
this.buf.append(n2);
} else {
this.buf.append("-1");
}
}
}
@@ -0,0 +1,18 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platform.daemon.message;
import com.tridium.platform.daemon.message.UpdateAppMessage;
public class UpdateR2StationMessage
extends UpdateAppMessage {
public UpdateR2StationMessage() {
super("r2station");
}
public UpdateR2StationMessage(String string, boolean bl, boolean bl2, boolean bl3, boolean bl4) {
super("r2station", string, bl, bl2, bl3, bl4);
}
}
@@ -0,0 +1,24 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platform.daemon.message;
import com.tridium.platform.daemon.message.DaemonMessage;
public class UpdateSshdMessage
extends DaemonMessage {
private StringBuffer buf = new StringBuffer("qnxsshd?update=true&port=");
public String getMessageString() {
return this.buf.toString();
}
public UpdateSshdMessage(boolean bl, int n) {
if (bl) {
this.buf.append(n);
} else {
this.buf.append("-1");
}
}
}
@@ -0,0 +1,18 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platform.daemon.message;
import com.tridium.platform.daemon.message.UpdateAppMessage;
public class UpdateStationMessage
extends UpdateAppMessage {
public UpdateStationMessage() {
super("station");
}
public UpdateStationMessage(String string, boolean bl, boolean bl2, boolean bl3, boolean bl4) {
super("station", string, bl, bl2, bl3, bl4);
}
}
@@ -0,0 +1,98 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.tridium.net.HttpUtil
* javax.baja.sys.BAbsTime
* javax.baja.timezone.BTimeZone
* javax.baja.timezone.DstRule
*/
package com.tridium.platform.daemon.message;
import com.tridium.net.HttpUtil;
import com.tridium.platform.daemon.message.XmlResponseMessage;
import javax.baja.sys.BAbsTime;
import javax.baja.timezone.BTimeZone;
import javax.baja.timezone.DstRule;
public class UpdateTimeMessage
extends XmlResponseMessage {
private StringBuffer message;
public String getMessageString() {
return this.message.toString();
}
public UpdateTimeMessage(BAbsTime bAbsTime, String string) {
this(bAbsTime, string, null);
}
public UpdateTimeMessage(BAbsTime bAbsTime, String string, BTimeZone bTimeZone) {
long l = System.currentTimeMillis();
this.message = new StringBuffer("time?update=true");
if (bAbsTime != null) {
this.message.append("&time=" + bAbsTime.getMillis());
}
if (string != null) {
this.message.append("&bajaTzId=");
this.message.append(HttpUtil.encodeUrl((String)string));
}
if (bTimeZone != null) {
this.message.append("&tzId=");
this.message.append(HttpUtil.encodeUrl((String)bTimeZone.getId()));
this.message.append("&tzUtcOffset=");
if (bAbsTime != null) {
this.message.append(String.valueOf(bTimeZone.getUtcOffset(bAbsTime.getMillis()) / 60000));
} else {
this.message.append(String.valueOf(bTimeZone.getUtcOffset(l) / 60000));
}
this.message.append("&dstOffset=");
if (bAbsTime != null) {
this.message.append(String.valueOf(bTimeZone.getDaylightAdjustment(bAbsTime.getMillis()) / 60000));
} else {
this.message.append(String.valueOf(bTimeZone.getDaylightAdjustment(l) / 60000));
}
DstRule dstRule = null;
dstRule = bAbsTime != null ? DstRule.getWallTimeRule((DstRule)bTimeZone.getDaylightStartRule(bAbsTime.getMillis()), (int)0, (BTimeZone)bTimeZone) : DstRule.getWallTimeRule((DstRule)bTimeZone.getDaylightStartRule(l), (int)0, (BTimeZone)bTimeZone);
if (dstRule != null) {
this.message.append("&dstStartHour=");
this.message.append(String.valueOf(dstRule.getTime().getHour()));
this.message.append("&dstStartMinute=");
this.message.append(String.valueOf(dstRule.getTime().getMinute()));
this.message.append("&dstStartMonth=");
this.message.append(String.valueOf(dstRule.getMonth().getOrdinal()));
this.message.append("&dstStartDay=");
this.message.append(String.valueOf(dstRule.getDay()));
this.message.append("&dstStartDayMode=");
this.message.append(String.valueOf(dstRule.getDayMode()));
this.message.append("&dstStartWeek=");
this.message.append(String.valueOf(dstRule.getWeek()));
if (dstRule.getWeekday() != null) {
this.message.append("&dstStartWeekDay=");
this.message.append(String.valueOf(dstRule.getWeekday().getOrdinal()));
}
}
DstRule dstRule2 = null;
dstRule2 = bAbsTime != null ? DstRule.getWallTimeRule((DstRule)bTimeZone.getDaylightEndRule(bAbsTime.getMillis()), (int)1, (BTimeZone)bTimeZone) : DstRule.getWallTimeRule((DstRule)bTimeZone.getDaylightEndRule(l), (int)1, (BTimeZone)bTimeZone);
if (dstRule2 != null) {
this.message.append("&dstEndHour=");
this.message.append(String.valueOf(dstRule2.getTime().getHour()));
this.message.append("&dstEndMinute=");
this.message.append(String.valueOf(dstRule2.getTime().getMinute()));
this.message.append("&dstEndMonth=");
this.message.append(String.valueOf(dstRule2.getMonth().getOrdinal()));
this.message.append("&dstEndDay=");
this.message.append(String.valueOf(dstRule2.getDay()));
this.message.append("&dstEndDayMode=");
this.message.append(String.valueOf(dstRule2.getDayMode()));
this.message.append("&dstEndWeek=");
this.message.append(String.valueOf(dstRule2.getWeek()));
if (dstRule2.getWeekday() != null) {
this.message.append("&dstEndWeekDay=");
this.message.append(String.valueOf(dstRule2.getWeekday().getOrdinal()));
}
}
}
}
}
@@ -0,0 +1,101 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.util.Lexicon
* javax.baja.xml.XElem
*/
package com.tridium.platform.daemon.message;
import com.tridium.platform.daemon.message.DaemonMessage;
import java.text.MessageFormat;
import javax.baja.util.Lexicon;
import javax.baja.xml.XElem;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public abstract class XmlResponseMessage
extends DaemonMessage {
public static final int STATUS_SUCCESS = 0;
public static final int STATUS_INCOMPLETE = 1;
public static final int STATUS_ERROR = 2;
private XElem response;
private String errorMessage;
public final String getMethod() {
return "GET";
}
public XElem getResponse() {
return this.response;
}
public void setResponse(XElem xElem) {
this.response = xElem;
}
public void setErrorMessage(String string) {
this.errorMessage = string;
}
public String getErrorMessage() {
if (this.errorMessage == null) {
if (this.response == null) {
throw new IllegalStateException("no response to check");
}
XElem xElem = this.response;
if (xElem.name().equals("error")) {
if (xElem.elem("message") != null) {
xElem = xElem.elem("message");
}
String string = null;
XElem xElem2 = xElem.elem("localized");
if (xElem2 != null) {
XElem[] xElemArray = xElem2.elems("lexArg");
Object[] objectArray = new String[xElemArray.length];
int n = 0;
while (n < xElemArray.length) {
objectArray[n] = xElemArray[n].get("value");
++n;
}
string = Lexicon.make((String)xElem2.get("module")).get(xElem2.get("key"), null);
if (string != null && objectArray.length > 0) {
string = MessageFormat.format(string, objectArray);
}
}
if (string == null && (xElem2 = xElem.elem("nonlocalized")) != null) {
string = xElem2.get("text");
}
if (string != null) {
this.errorMessage = string;
}
}
}
return this.errorMessage;
}
public int getStatus() {
if (this.errorMessage == null) {
if (this.response == null) {
return 1;
}
if (this.response.name().equals("error")) {
return 2;
}
} else {
return 2;
}
return 0;
}
private final /* synthetic */ void this() {
this.response = null;
this.errorMessage = null;
}
public XmlResponseMessage() {
this.this();
}
}
@@ -0,0 +1,94 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.util.Lexicon
*/
package com.tridium.platform.daemon.task;
import com.tridium.platform.daemon.task.DaemonSessionTask;
import javax.baja.platform.ICancelHint;
import javax.baja.util.Lexicon;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class CancelableDaemonSessionTask
extends DaemonSessionTask
implements ICancelHint {
private String cancelLabel;
private boolean canceled;
private ICancelHint cancelHint;
private boolean allowCancel;
public synchronized void cancel() {
if (this.allowCancel) {
this.canceled = true;
}
}
public synchronized void setIsCancelEnabled(boolean bl) {
this.allowCancel = bl;
}
public synchronized boolean isCancelEnabled() {
return this.allowCancel;
}
public synchronized boolean isCanceled() {
boolean bl = false;
if (this.allowCancel && (this.canceled || this.cancelHint != null && this.cancelHint.isCanceled())) {
bl = true;
}
return bl;
}
public String getCancelLabel(String string) {
return this.cancelLabel == null ? string : this.cancelLabel;
}
public void setCancelLabel(String string) {
this.cancelLabel = string;
}
private final /* synthetic */ void this() {
this.cancelLabel = null;
this.canceled = false;
this.allowCancel = true;
}
public CancelableDaemonSessionTask(Lexicon lexicon, String string, String string2) {
this(lexicon, string, string2, new Object[0], -1, null);
}
public CancelableDaemonSessionTask(Lexicon lexicon, String string, String string2, Object[] objectArray) {
this(lexicon, string, string2, objectArray, -1, null);
}
public CancelableDaemonSessionTask(Lexicon lexicon, String string, String string2, int n) {
this(lexicon, string, string2, new Object[0], n, null);
}
public CancelableDaemonSessionTask(Lexicon lexicon, String string, String string2, Object[] objectArray, int n) {
this(lexicon, string, string2, objectArray, n, null);
}
public CancelableDaemonSessionTask(Lexicon lexicon, String string, String string2, ICancelHint iCancelHint) {
this(lexicon, string, string2, new Object[0], -1, iCancelHint);
}
public CancelableDaemonSessionTask(Lexicon lexicon, String string, String string2, Object[] objectArray, ICancelHint iCancelHint) {
this(lexicon, string, string2, objectArray, -1, iCancelHint);
}
public CancelableDaemonSessionTask(Lexicon lexicon, String string, String string2, int n, ICancelHint iCancelHint) {
this(lexicon, string, string2, new Object[0], n, iCancelHint);
}
public CancelableDaemonSessionTask(Lexicon lexicon, String string, String string2, Object[] objectArray, int n, ICancelHint iCancelHint) {
super(lexicon, string, string2, objectArray, n);
this.this();
this.cancelHint = iCancelHint;
}
}
@@ -0,0 +1,85 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.baja.util.Lexicon
*/
package com.tridium.platform.daemon.task;
import javax.baja.util.Lexicon;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class DaemonSessionTask {
private String title;
private String message;
private int total;
private int progress;
private boolean immediate;
public String getTitle() {
return this.title;
}
public String getMessage() {
return this.message;
}
public void setMessage(String string) {
this.message = string;
}
public void setProgress(int n) {
this.progress = n;
}
public int getProgress() {
return this.progress;
}
public int getTotal() {
return this.total;
}
public void setImmediate(boolean bl) {
this.immediate = bl;
}
public boolean isImmediate() {
return this.immediate;
}
private final /* synthetic */ void this() {
this.immediate = false;
}
public DaemonSessionTask(Lexicon lexicon, String string, String string2) {
this(lexicon, string, string2, new Object[0], -1);
}
public DaemonSessionTask(Lexicon lexicon, String string, String string2, Object[] objectArray) {
this(lexicon, string, string2, objectArray, -1);
}
public DaemonSessionTask(Lexicon lexicon, String string, String string2, int n) {
this(lexicon, string, string2, new Object[0], n);
}
public DaemonSessionTask(Lexicon lexicon, String string, String string2, Object[] objectArray, int n) {
this.this();
this.title = lexicon.getText(string);
this.message = lexicon.getText(string2, objectArray);
this.total = n;
this.progress = 0;
}
public DaemonSessionTask(String string, String string2, int n) {
this.this();
this.title = string;
this.message = string2;
this.total = n;
this.progress = 0;
}
}
@@ -0,0 +1,33 @@
/*
* Decompiled with CFR 0.152.
*/
package com.tridium.platform.daemon.task;
import com.tridium.platform.daemon.task.DaemonSessionTask;
public interface DaemonSessionTaskListener {
public static final DaemonSessionTaskListener NULL_TASK_LISTENER = new DaemonSessionTaskListener(){
public final void taskStarted(DaemonSessionTask daemonSessionTask) {
}
public final void taskUpdated(DaemonSessionTask daemonSessionTask) {
}
public final void taskFinished(DaemonSessionTask daemonSessionTask) {
}
public final boolean isCancelEnabled() {
return true;
}
};
public void taskStarted(DaemonSessionTask var1);
public void taskUpdated(DaemonSessionTask var1);
public void taskFinished(DaemonSessionTask var1);
public boolean isCancelEnabled();
}