/* * Decompiled with CFR 0.152. * * Could not load the following classes: * com.tridium.net.HttpUtil * javax.baja.file.FilePath * javax.baja.log.Log * javax.baja.naming.SlotPath * javax.baja.sys.BValue * 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.install; import com.tridium.install.BModuleList; import com.tridium.install.GetModuleListMessage; import com.tridium.install.installable.BModuleInstallable; import com.tridium.net.HttpUtil; import com.tridium.platform.daemon.BDaemonSession; import com.tridium.platform.daemon.message.RequestGarbageCollectionMessage; 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.FilePath; import javax.baja.log.Log; import javax.baja.naming.SlotPath; import javax.baja.platform.ICancelHint; import javax.baja.sys.BValue; 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 BRemoteModuleList extends BModuleList { public static final Type TYPE; private static Log log; private BDaemonSession session; private boolean initialized; private XElem[] moduleElems; private Object MODULE_ELEM_LOCK; static /* synthetic */ Class class$com$tridium$install$BRemoteModuleList; public Type getType() { return TYPE; } public void doReload(DaemonSessionTaskListener daemonSessionTaskListener) { this.init(daemonSessionTaskListener); } public void reset() { super.reset(); this.moduleElems = null; this.getModules().removeAll(); this.initialized = false; } /* * WARNING - Removed try catching itself - possible behaviour change. * Unable to fully structure code * Enabled aggressive block sorting * Enabled unnecessary exception pruning * Enabled aggressive exception aggregation */ public synchronized void doInit(DaemonSessionTaskListener var1_1) { if (!this.isLocalInstance()) { return; } if (this.initialized != false) return; var2_2 = Clock.ticks(); BRemoteModuleList.log.trace("building remote module list"); this.getModules().removeAll(); var4_3 = this.getNewModuleInfoTask(); if (var1_1 != null) { var1_1.taskStarted(var4_3); } try { try { var8_4 = this.MODULE_ELEM_LOCK; synchronized (var8_4) { if (this.moduleElems == null) { this.moduleElems = this.fetchModules(null); } var7_5 = this.moduleElems; // MONITOREXIT @DISABLED, blocks:[0, 1, 2, 4] lbl18 : MonitorExitStatement: MONITOREXIT : var8_4 var10_8 = 0; if (true) ** GOTO lbl34 } do { if (!(var11_9 = this.uriToFilePath(var7_5[var10_8].get("path"))).getParent().getName().equals("lib")) { var12_10 = new BModuleInstallable(var7_5[var10_8].getl("size", (long)-1), var11_9.getName(), var7_5[var10_8].elem("module")); var13_11 = SlotPath.escape((String)var12_10.getInstallableName()); BRemoteModuleList.log.trace("adding remote module " + var12_10.getInstallableName()); if (this.getModules().getProperty(var13_11) != null) { BRemoteModuleList.log.error(this.getLexicon().getText("ModuleList.exception.dupModule", new Object[]{var12_10.getInstallableName()})); throw new LocalizableRuntimeException("platform", "ModuleList.exception.dupModule", new Object[]{var12_10.getInstallableName()}); } this.getModules().add(var13_11, (BValue)var12_10); } ++var10_8; lbl34: // 2 sources } while (var10_8 < var7_5.length && !var4_3.isCanceled()); if (var4_3.isCanceled()) { throw new ICancelHint.CanceledException(); } this.initialized = true; } catch (ICancelHint.CanceledException var7_6) { throw var7_6; } catch (Exception var7_7) { throw new LocalizableRuntimeException("platform", "RemoteModuleList.exception.xmlParse", (Throwable)var7_7); } var6_14 = null; } catch (Throwable var5_12) { var6_13 = null; Log.getLog((String)"platform.daemonTuning").trace("moduleList " + (Clock.ticks() - var2_2) + "ms"); if (var1_1 == null) throw var5_12; var1_1.taskFinished(var4_3); throw var5_12; } Log.getLog((String)"platform.daemonTuning").trace("moduleList " + (Clock.ticks() - var2_2) + "ms"); if (var1_1 == null) return; var1_1.taskFinished(var4_3); } protected XElem[] fetchModules(String string) throws Exception, ConnectException { XElem[] xElemArray = XParser.make((InputStream)this.session.getInputStream(new GetModuleListMessage(false, true, true, string))).parse().elems("moduleItem"); try { if (this.session.getHostProperties().getOsName().toLowerCase().startsWith("win")) { log.trace("sending remote garbage collection"); this.session.sendMessage(RequestGarbageCollectionMessage.getInstance()); } } catch (Exception exception) {} return xElemArray; } /* * WARNING - Removed try catching itself - possible behaviour change. * Enabled aggressive block sorting * Enabled unnecessary exception pruning * Enabled aggressive exception aggregation */ public void setModuleElems(XElem[] xElemArray) { Object object = this.MODULE_ELEM_LOCK; synchronized (object) { this.moduleElems = xElemArray; return; } } public CancelableDaemonSessionTask getNewModuleInfoTask() { return new CancelableDaemonSessionTask(this.getLexicon(), "RemoteModuleList.dialog.loading.title", "RemoteModuleList.dialog.loading.message"); } private final FilePath uriToFilePath(String string) { if (string.startsWith("/files")) { return new FilePath("/" + HttpUtil.decodeUrl((String)string.substring(7))); } if (string.startsWith("/niagara")) { return new FilePath("!" + HttpUtil.decodeUrl((String)string.substring(9))); } 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()); } } private final /* synthetic */ void this() { this.session = null; this.initialized = false; this.moduleElems = null; this.MODULE_ELEM_LOCK = new Object(); } public BRemoteModuleList() { this.this(); } public BRemoteModuleList(BDaemonSession bDaemonSession) { this.this(); this.session = bDaemonSession; this.setLocalInstance(true); this.reset(); } static { Class clazz = class$com$tridium$install$BRemoteModuleList; if (clazz == null) { clazz = class$com$tridium$install$BRemoteModuleList = BRemoteModuleList.class("[Lcom.tridium.install.BRemoteModuleList;", false); } TYPE = Sys.loadType((Class)clazz); log = Log.getLog((String)"platform"); } }