public String getSetting(String s) { String s1 = getProperty(s); if (s1.length() == 0) { return SiteViewGroup.currentSiteView().getSetting(s); } else { return s1; } }
public static SiteViewObject getSiteViewForID(String s) { if (s.length() == 0 || !isPortalID(s)) { return SiteViewGroup.currentSiteView(); } else { String s1 = getServerID(s); return getSiteViewForServerID(s1); } }
public Vector getScalarValues(ScalarProperty scalarproperty, HTTPRequest httprequest, CGI cgi) throws SiteViewException { if (scalarproperty == pItems) { SiteViewGroup siteviewgroup = SiteViewGroup.currentSiteView(); Array array = CGI.getAllowedGroupIDsForAccount(httprequest); Enumeration enumeration = array.elements(); Vector vector1 = new Vector(); Vector vector2 = new Vector(); String s = getFullID(); while (enumeration.hasMoreElements()) { MonitorGroup monitorgroup = (MonitorGroup) siteviewgroup.getElement((String) enumeration.nextElement()); if (monitorgroup != null) { Enumeration enumeration2 = monitorgroup.getMonitors(); while (enumeration2.hasMoreElements()) { Monitor monitor = (Monitor) enumeration2.nextElement(); if (!(monitor instanceof SubGroup) && !s.equals(monitor.getFullID()) && ("SNMPMonitor".equals(monitor.getClassProperty("class")) || (monitor instanceof BandwidthMonitor) || "ScriptMonitor".equals(monitor.getClassProperty("class")) || "NTCounterMonitor".equals(monitor.getClassProperty("class")) || "DatabaseMonitor".equals(monitor.getClassProperty("class")))) // dingbing.xu { vector2.addElement(monitor.getProperty(pGroupID) + " " + monitor.getProperty(pID)); vector2.addElement( monitorgroup.getProperty(pName) + ": " + monitor.getProperty(pName)); } } } } for (Enumeration enumeration1 = vector2.elements(); enumeration1.hasMoreElements(); vector1.addElement(enumeration1.nextElement())) {} return vector1; } else if (scalarproperty == pOperation) { Vector vector = new Vector(); vector.addElement("Add"); vector.addElement("Add"); vector.addElement("Multiply"); vector.addElement("Multiply"); vector.addElement("Subtract12"); vector.addElement("Subtract 1 from 2"); vector.addElement("Subtract21"); vector.addElement("Subtract 2 from 1"); vector.addElement("Divide12"); vector.addElement("Divide 1 by 2"); vector.addElement("Divide21"); vector.addElement("Divide 2 by 1"); return vector; } else { return super.getScalarValues(scalarproperty, httprequest, cgi); } }
private void updateMaster(HashMap hashmap) { SiteViewGroup siteviewgroup = SiteViewGroup.currentSiteView(); String s; for (Enumeration enumeration = hashmap.keys(); enumeration.hasMoreElements(); siteviewgroup.setProperty(s, (String) hashmap.get(s))) { s = (String) enumeration.nextElement(); } siteviewgroup.saveSettings(); }
public static Portal getPortal() { if (portal == null) { portal = new Portal(); portal.checkConfiguration = new DetectPortalChange(); SiteViewGroup siteviewgroup = SiteViewGroup.currentSiteView(); portal.checkConfiguration.execute(); int i = siteviewgroup.getSettingAsLong("_fileCheckFrequency", 120) * 1000; if (siteviewgroup.maintenanceScheduler != null) { siteviewgroup.maintenanceScheduler.scheduleRepeatedPeriodicAction( portal.checkConfiguration, i); } } return portal; }
protected Array getMonitorsToRun() { HashMap hashmap = new HashMap(); Array array = new Array(); SiteViewGroup siteviewgroup = SiteViewGroup.currentSiteView(); Enumeration enumeration = getMultipleValues(pItems); label0: do { if (!enumeration.hasMoreElements()) { break; } String s = (String) enumeration.nextElement(); String as[] = TextUtils.split(s); Object obj = null; Object obj1 = null; if (as.length == 1) { MonitorGroup monitorgroup = (MonitorGroup) siteviewgroup.getElement(as[0]); if (monitorgroup == null) { continue; } Enumeration enumeration1 = monitorgroup.getMonitors(); do { Monitor monitor; do { if (!enumeration1.hasMoreElements()) { continue label0; } monitor = (Monitor) enumeration1.nextElement(); } while (!(monitor instanceof AtomicMonitor)); addToMonitorList(monitor, array, hashmap); } while (true); } if (as.length > 1) { String s1 = as[0] + SiteViewGroup.ID_SEPARATOR + as[1]; MonitorGroup monitorgroup1 = (MonitorGroup) siteviewgroup.getElement(as[0]); if (monitorgroup1 != null) { Monitor monitor1 = (Monitor) siteviewgroup.getElement(s1); if (monitor1 != null) { addToMonitorList(monitor1, array, hashmap); } } } } while (true); return array; }
/** CAUTION: Decompiled by hand. */ public static void loadHealthGroupList() { synchronized (groupIDsInHealth) { groupIDsInHealth.clear(); SiteViewGroup siteviewgroup = SiteViewGroup.currentSiteView(); MonitorGroup monitorgroup = (MonitorGroup) siteviewgroup.getElementByID("__Health__"); if (monitorgroup == null) { createHealthGroupList("__Health__"); } else { groupIDsInHealth.add(monitorgroup.getProperty(SiteViewObject.pID)); Enumeration enumeration = monitorgroup.getElements(); while (enumeration.hasMoreElements()) { SiteViewObject siteviewobject = (SiteViewObject) enumeration.nextElement(); if (siteviewobject instanceof SubGroup) { addSubGroup((SubGroup) siteviewobject); } } } } }
public String verify( StringProperty stringproperty, String s, HTTPRequest httprequest, HashMap hashmap) { String s1 = super.verify(stringproperty, s, httprequest, hashmap); if (stringproperty == pMachineName) { String s2 = getFullID(); SiteViewObject siteviewobject = Portal.getSiteViewForID(s2); if (siteviewobject instanceof PortalSiteView) { PortalSiteView portalsiteview = (PortalSiteView) siteviewobject; HashMap hashmap1 = portalsiteview.getMasterConfig(); if (!s.equals(TextUtils.getValue(hashmap1, "_defaultMachine"))) { hashmap1.put("_defaultMachine", s); portalsiteview.saveMasterConfig(); } } else if (siteviewobject instanceof SiteViewGroup) { SiteViewGroup siteviewgroup = SiteViewGroup.currentSiteView(); if (!s.equals(siteviewgroup.getProperty("_defaultMachine"))) { siteviewgroup.setProperty("_defaultMachine", s); siteviewgroup.saveSettings(); } } } return s1; }
protected boolean update() { double ad[] = initializeStats(); String as[] = initializeNameList(); Enumeration enumeration = getMultipleValues(pItems); SiteViewGroup siteviewgroup = SiteViewGroup.currentSiteView(); long l = getPropertyAsLong(pDelay) * 1000L; String s = getProperty(pStatic); s = s.trim(); if (getPropertyAsBoolean(pRunMonitors)) { checkSequentially(ad, as, l, ""); } else { int i = 0; do { if (!enumeration.hasMoreElements()) { break; } String s2 = (String) enumeration.nextElement(); Monitor monitor = (Monitor) siteviewgroup.getElement(s2.replace(' ', '/')); if (monitor != this) { if (monitor != null) { if (!(monitor instanceof MonitorGroup)) { updateStats(ad, as, monitor, i++); } } else { LogManager.log( "Error", "Could not get monitor " + s2 + " in Composite Monitor " + getProperty(pName)); } } } while (true); } String s1 = getProperty(pOperation); double d = 0.0D; double d1 = ad[0]; double d2 = ad[1]; String s3 = ""; String s4 = "ok"; if (s1.equals("Add")) { if (d1 != -999D && d2 != -999D) { d = d1 + d2; s3 = s3 + as[0] + " = " + d1 + ", " + as[1] + " = " + d2 + ", Add Result= " + d; } else { s4 = "n/a"; s3 = s3 + " Add Result= n/a"; } } else if (s1.equals("Multiply")) { if (d1 != -999D && d2 != -999D) { d = d1 * d2; s3 = s3 + as[0] + " = " + d1 + ", " + as[1] + " = " + d2 + ", Multiply Result= " + d; } else { s4 = "n/a"; s3 = s3 + " Multiply Result= n/a"; } } else if (s1.equals("Subtract12")) { if (d1 != -999D && d2 != -999D) { d = d1 - d2; s3 = s3 + as[0] + " = " + d1 + ", " + as[1] + " = " + d2 + ", Subtract Result= " + d; } else { s4 = "n/a"; s3 = s3 + " Subtract Result= n/a"; } } else if (s1.equals("Subtract21")) { if (d1 != -999D && d2 != -999D) { d = d2 - d1; s3 = s3 + as[0] + " = " + d1 + ", " + as[1] + " = " + d2 + ", Subtract Result= " + d; } else { s4 = "n/a"; s3 = s3 + " Subtract Result= n/a"; } } else if (s1.equals("Divide12")) { if (d1 != -999D && d2 != -999D && d2 != 0.0D) { d = d1 / d2; s3 = s3 + as[0] + " = " + d1 + ", " + as[1] + " = " + d2 + ", Divide Result= " + d; } else { s4 = "n/a"; s3 = s3 + " Divide Result= n/a"; } } else if (s1.equals("Divide21")) { if (d1 != -999D && d2 != -999D && d1 != 0.0D) { d = d2 / d1; s3 = s3 + as[0] + " = " + d1 + ", " + as[1] + " = " + d2 + ", Divide Result= " + d; } else { s4 = "n/a"; s3 = s3 + " Divide Result= n/a"; } } if (!s4.equals("n/a") && s.length() > 0) { String s5 = s.substring(0, 1); s = s.substring(1); if (s.length() > 0) { double d3 = TextUtils.toDouble(s); if (d3 != 0.0D && d != -999D) { if (s5.equals("+")) { d += d3; } else if (s5.equals("*")) { d *= d3; } else if (s5.equals("-")) { d -= d3; } else if (s5.equals("/")) { d /= d3; } } } int j = s3.indexOf("Result= "); s3 = s3.substring(0, j) + "Result= " + d; } if (stillActive()) { synchronized (this) { if (s4.equals("ok")) { setProperty(pResult, String.valueOf(d)); setProperty(pStatus, s4); if (getProperty(pValueLabels).length() > 0) { setProperty(pStateString, s3 + ", " + (String) getLabels().get("result") + " = " + d); } else { setProperty(pStateString, s3); } } else { setProperty(pResult, "n/a"); setProperty(pStatus, "n/a"); setProperty(pNoData, "n/a"); setProperty(pStateString, s3); } } } return true; }
public synchronized boolean execute() { try { SiteViewGroup siteviewgroup = SiteViewGroup.currentSiteView(); Array array = new Array(); Array array1 = new Array(); Array array2 = new Array(); Array array3 = siteviewgroup.getGroupFiles(); Enumeration enumeration = array3.elements(); File file = null; File file1 = null; File file2 = null; File file3 = null; HashSet hashset = new HashSet(); for (Enumeration enumeration1 = fileNameMap.keys(); enumeration1.hasMoreElements(); hashset.add(enumeration1.nextElement())) {} String s; for (; enumeration.hasMoreElements(); hashset.remove(s)) { File file4 = (File) enumeration.nextElement(); s = file4.getAbsolutePath(); Long long1 = (Long) fileNameMap.get(s); if (long1 == null) { if (file4.getName().equals("history.config")) { file = file4; } else if (file4.getName().equals("dynamic.config")) { file2 = file4; } else { array.add(file4); } } else if (long1.longValue() != file4.lastModified()) { if (file4.getName().equals("history.config")) { file1 = file4; } else if (file4.getName().equals("dynamic.config")) { file3 = file4; } else { array1.add(file4); if (file4.getAbsolutePath().endsWith(".mg")) { // TopazConfigurator.checkModified(file4); } } } long1 = new Long(file4.lastModified()); fileNameMap.put(s, long1); } if (file2 != null) { array.add(file2); } if (file3 != null) { array1.add(file3); } if (file != null) { array.add(file); } if (file1 != null) { array1.add(file1); } String s1; for (Iterator iterator = hashset.iterator(); iterator.hasNext(); LogManager.log("Debug", "group deleted: " + s1)) { s1 = (String) iterator.next(); fileNameMap.remove(s1); File file5 = new File(s1); array2.add(file5); if (file5.getAbsolutePath().endsWith(".mg")) { // TopazConfigurator.checkDeleted(file5); } } HashMap hashmap = new HashMap(); siteviewgroup.adjustGroups(array, array1, array2, hashmap); for (HashMapIterator hashmapiterator = hashmap.begin(); !hashmapiterator.atEnd(); hashmapiterator.advance()) { fileNameMap.put(hashmapiterator.key(), hashmapiterator.value()); } } catch (Exception exception) { LogManager.log("Error", "Error loading configuration: " + exception); LogManager.log("Error", " detail: " + FileUtils.stackTraceText(exception)); } clearConfigChangeFlag(); return true; }
public ArrayList process(HashMap hashmap, Date date, Date date1, HashMap hashmap1) { SiteViewGroup siteviewgroup = SiteViewGroup.currentSiteView(); long l = siteviewgroup.getSettingAsLong("_alertLogReadChunkSize", 0x19000); ArrayList array = new ArrayList(); if (logfile == null || !logfile.exists()) { LogManager.log("Error", "Alert log " + logfile.getAbsolutePath() + " does not exist"); return array; } if (!logfile.canRead()) { LogManager.log("Error", "Alert log " + logfile.getAbsolutePath() + " cannot be read"); return array; } boolean flag = false; String s = logfile.getAbsolutePath(); long l1 = Platform.FILE_NEWLINE.length(); long l2 = logfile.length(); boolean flag1 = false; if (hashmap1 != null) flag1 = !hashmap1.isEmpty(); long l3 = 0L; long l4 = 0x7fffffffffffffffL; if (date != null) l3 = date.getTime(); if (date1 != null) l4 = date1.getTime(); long l5 = 0x7fffffffffffffffL; long l6 = 0L; Braf braf = null; try { do { if (flag) break; long l7 = l2 - l; long l8 = l2; l2 = -1L; if (l7 < 0L) l7 = 0L; long l9 = l7; braf = new Braf(s, l7); HashMap hashmap2 = null; ArrayList array1 = new ArrayList(); String s2 = ""; StringBuffer stringbuffer = new StringBuffer(); label0: do { String s1; do if ((s1 = braf.readLine()) == null) break label0; while (s1.indexOf("<pre>") >= 0); if (isDateLine(s1) && getDateInfo(s1, lineDate)) { if (l2 < 0L) l2 = l9 - 1L; if (hashmap2 != null) { if (s2.length() > 0) { addAlertTag(hashmap2, s2, stringbuffer.toString()); s2 = ""; stringbuffer.setLength(0); } addAlertEntry(hashmap2, array1, hashmap); } Date date2 = getDate(lineDate); long l10 = date2.getTime(); hashmap2 = null; if (l10 >= l3 && l10 <= l4) if (flag1) { if (ScheduleProperty.isEnabled(hashmap1, date2)) { hashmap2 = new HashMap(); hashmap2.put("date", date2); } } else { hashmap2 = new HashMap(); hashmap2.put("date", date2); } if (l10 < l5) l5 = l10; if (l10 > l6) l6 = l10; } else if (hashmap2 != null) if (s1.startsWith(ALERT_LINE_PREFIX)) { if (s2.length() > 0) { addAlertTag(hashmap2, s2, stringbuffer.toString()); s2 = ""; stringbuffer.setLength(0); } int i = s1.indexOf(COLON_SUFFIX); if (i >= 0) { s2 = s1.substring(1, i); stringbuffer.setLength(0); stringbuffer.append(s1.substring(i + COLON_SUFFIX.length())); } } else if (s2.length() > 0) { if (stringbuffer.length() > 0) stringbuffer.append("\n"); stringbuffer.append(s1); } l9 += (long) s1.length() + l1; } while (l9 < l8); if (hashmap2 != null) { if (s2.length() > 0) addAlertTag(hashmap2, s2, stringbuffer.toString()); addAlertEntry(hashmap2, array1, hashmap); } for (int j = 0; j < array.size(); j++) array1.add(array.get(j)); array = array1; if (l7 == 0L) flag = true; braf.close(); braf = null; if (l5 <= l3 && l6 >= l4) flag = true; } while (true); } catch (IOException ioexception) { LogManager.log("Error", "I/O error reading file: " + s); System.out.println("I/O error reading file: " + s); } finally { if (braf != null) try { braf.close(); } catch (IOException ioexception1) { } } return array; }