예제 #1
0
 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);
   }
 }
예제 #2
0
 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;
 }