/* * 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"); } } }