Esempio n. 1
0
  Action createAction(Rule rule) {
    String s = rule.getProperty(Rule.pAction);
    Action action = Action.createAction(s);
    action.setOwner(rule);
    int i = s.indexOf(" ");
    String as[];
    if (i >= 0) {
      as = TextUtils.split(s.substring(i + 1, s.length()));
    } else {
      as = new String[0];
    }
    Array array = new Array();
    HashMapOrdered hashmapordered = new HashMapOrdered(true);
    for (int j = 0; j < as.length; j++) {
      int k = as[j].indexOf("=");
      if (k == -1) {
        array.add(as[j]);
      } else {
        hashmapordered.add(as[j].substring(0, k), as[j].substring(k + 1));
      }
    }

    action.initializeFromArguments(array, hashmapordered);
    return action;
  }
Esempio n. 2
0
  synchronized HashMap getLabels() {
    if (labelsCache == null) {
      labelsCache = new HashMap();
      if (getProperty(pValueLabels).length() > 0) {
        String as[] = TextUtils.split(getProperty(pValueLabels), ",");
        for (int i = 0; i < as.length; i++) {
          String s1 = as[i];
          String s2 = getNameFromIndex(i);
          labelsCache.add(s2, s1.trim());
        }

      } else {
        for (int j = 0; j < maxNumberOfMatches; j++) {
          String s = getNameFromIndex(j);
          labelsCache.add(s, s);
        }
      }
      ArrayList array = getProperties();
      Enumeration enumeration = (Enumeration) array.iterator();
      do {
        if (!enumeration.hasMoreElements()) {
          break;
        }
        StringProperty stringproperty = (StringProperty) enumeration.nextElement();
        if (stringproperty.isThreshold() && stringproperty.getName().indexOf("value") < 0) {
          labelsCache.add(stringproperty.getLabel(), stringproperty.getLabel());
        }
      } while (true);
    }
    return labelsCache;
  }
Esempio n. 3
0
  /**
   * CAUTION: Decompiled by hand.
   *
   * @return
   */
  private String[] getReplacementChars() {
    synchronized (replacementCharsSync) {
      if (replacementCharsInitialized) {
        return replacementChars;
      }
      String s = getSetting("_scriptMonitorReplacementChars");
      if (s != null && s.length() > 0) {
        String as[] = TextUtils.split(s, " ");
        if (as != null) {
          Vector vector = new Vector();
          for (int i = 0; i < as.length; i++) {
            String s1 = as[i];
            if (s1 == null) {
              continue;
            }
            String s2 = s1.trim();
            if (s2.length() > 0) {
              vector.add(s2);
            }
          }

          if (vector.size() > 0) {
            replacementChars = new String[vector.size()];
            for (int j = 0; j < vector.size(); j++) {
              replacementChars[j] = (String) vector.get(j);
            }
          }
        }
      }
      replacementCharsInitialized = true;
      return replacementChars;
    }
  }
 synchronized Array getCounters() {
   Array array = new Array();
   String s = getCountersContent();
   String as[] = TextUtils.split(s, ",");
   if (as.length > 0) {
     for (int i = 0; i < as.length; i++) {
       array.add(as[i].trim());
     }
   }
   if ((getMediaTrace() & 0x10) != 0) {
     mediaDebug("Active counters: " + s);
   }
   return array;
 }
 private boolean parseRecord(String s) {
   boolean flag = false;
   int i = s.indexOf(getDataSentinel());
   if (i >= 0) {
     String as[] = TextUtils.split(s);
     if (as.length == 2) {
       flag = parseFinal(as[0], as[1]);
     }
   }
   if ((getMediaTrace() & 4) != 0) {
     mediaDebug("parse: " + s);
   }
   return flag;
 }
Esempio n. 6
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;
 }
Esempio n. 7
0
  public static Vector getScriptList(String s, String s1, HTTPRequest httprequest) {
    Vector vector = new Vector();
    String s2 = s1;
    if (s2 == null || s2.length() == 0) {
      s2 = "scripts";
    }
    s = Machine.getFullMachineID(s, httprequest);
    if (Machine.isPortalMachineID(s)) {
      String s3 = Machine.getServerIDFromMachineID(s);
      PortalSiteView portalsiteview = (PortalSiteView) Portal.getPortal().getElement(s3);
      if (portalsiteview != null) {
        String s4 =
            "/SiteView/cgi/go.exe/SiteView?page=remoteOp&operation=scripts&machineID="
                + Machine.getMachineFromMachineID(s)
                + "&account=administrator";
        ArrayList array2 = portalsiteview.sendURLToRemoteSiteView(s4, null);
        for (int i1 = 0; i1 < array2.size(); i1++) {
          vector.addElement(array2.get(i1));
        }

      } else {
        LogManager.log("Error", "Could not find SiteView ID: " + s3);
      }
    } else if (Machine.isNTSSH(s)) {
      RemoteFile remotefile = new RemoteFile(s, "scripts");
      ArrayList array = remotefile.listFiles();
      for (int j = 0; j < array.size(); j++) {
        String s5 = I18N.toNullEncoding((String) array.get(j));
        if (!s5.endsWith(".txt")
            && !s5.endsWith("directory.bat")
            && (s5.endsWith(".bat")
                || s5.endsWith(".vbs")
                || s5.endsWith(".exe")
                || s5.endsWith(".pl")
                || s5.endsWith(".sh"))) {
          String as1[] = TextUtils.split(s5, " ");
          s5 = as1[as1.length - 1].trim();
          vector.addElement(s5);
          vector.addElement(s5);
        }
      }

    } else if (Platform.isCommandLineRemote(s)) {
      RemoteFile remotefile1 = new RemoteFile(s, "scripts");
      int i = Machine.getOS(s);
      ArrayList array1 = remotefile1.listFiles();
      for (int l = 0; l < array1.size(); l++) {
        String s7 = I18N.toNullEncoding((String) array1.get(l));
        if (!s7.endsWith(".txt") && (!Platform.isUnix(i) || !s7.startsWith("."))) {
          vector.addElement(s7);
          vector.addElement(s7);
        }
      }

    } else {
      File file = new File(Platform.getUsedDirectoryPath(s2, httprequest.getAccount()));
      String as[] = file.list();
      for (int k = 0; k < as.length; k++) {
        String s6 = I18N.toNullEncoding(as[k]);
        if (s6.endsWith(".txt") || Platform.isUnix() && s6.startsWith(".")) {
          continue;
        }
        File file1 = new File(file, as[k]);
        if (!file1.isDirectory()) {
          vector.addElement(s6);
          vector.addElement(s6);
        }
      }
    }
    return vector;
  }