Exemplo n.º 1
0
 private String valueFormattedStringImplementation(String s, int i, boolean flag) {
   i = getPrecision(i);
   if (s.equals("n/a") || s.length() == 0) {
     return "n/a";
   }
   if (units != null && units.length() > 0) {
     String s1 = getDisplayUnits();
     try {
       s = convertValue(s, units, s1);
     } catch (IllegalConversionException illegalconversionexception) {
       s1 = units;
     }
     if (flag) {
       return TextUtils.floatToFormattedString(toFloat(s), i)
           + unitSeparator
           + getUnitDisplayString(s1);
     } else {
       return TextUtils.floatToFormattedString(toFloat(s), i);
     }
   }
   if (TextUtils.isNumber(s)) {
     return TextUtils.floatToFormattedString(toFloat(s), i);
   } else {
     return s;
   }
 }
Exemplo n.º 2
0
  void processSiteView(PortalSiteView portalsiteview) {
    boolean flag = visitor.siteviewPre(portalsiteview);
    if (flag) {
      if (debug) {
        PortalSiteView _tmp = portalsiteview;
        TextUtils.debugPrint("search groups: " + portalsiteview.getProperty(PortalSiteView.pTitle));
      }
      Array array = getSortedGroupIDs(portalsiteview);
      for (int i = 0; i < array.size(); i++) {
        String s = (String) array.at(i);
        MonitorGroup monitorgroup = (MonitorGroup) portalsiteview.getElement(s);
        if (monitorgroup == null || !itemFilter.itemAllowed(monitorgroup.getFullID())) {
          continue;
        }
        if (debug) {
          MonitorGroup _tmp1 = monitorgroup;
          TextUtils.debugPrint("process group: " + monitorgroup.getProperty(MonitorGroup.pName));
        }
        processGroup(monitorgroup, portalsiteview);
      }

      if (addAlerts) {
        Array array1 =
            portalsiteview.getElementsOfClass("COM.dragonflow.SiteView.Rule", false, false);
        Rule rule;
        for (Enumeration enumeration = array1.elements();
            enumeration.hasMoreElements();
            processAlert(rule, null, null, portalsiteview)) {
          rule = (Rule) enumeration.nextElement();
        }
      }
    }
    visitor.siteviewPost(portalsiteview);
  }
Exemplo n.º 3
0
 public PortalQuery(
     HashMap hashmap, PortalQueryVisitor portalqueryvisitor, HTTPRequest httprequest) {
   itemFilter = null;
   addAlerts = false;
   findObjects = 7;
   request = null;
   config = null;
   visitor = null;
   debug = false;
   visitor = portalqueryvisitor;
   if (httprequest == null) {
     request = new HTTPRequest();
     request.setUser("administrator");
   } else {
     request = httprequest;
   }
   config = MasterConfig.getMasterConfig();
   itemFilter = new PortalFilter(hashmap);
   User user = request.getUser();
   PortalFilter portalfilter = new PortalFilter(user.getProperty("_query"));
   itemFilter.addFilter(portalfilter);
   if (TextUtils.getValue(hashmap, "serverDepth").length() > 0) {
     findObjects = 4;
   } else if (TextUtils.getValue(hashmap, "groupDepth").length() > 0) {
     findObjects = 6;
   }
   if (TextUtils.getValue(hashmap, "trace").length() > 0) {
     debug = true;
   }
   portalqueryvisitor.initialize(hashmap, this);
 }
Exemplo n.º 4
0
 public void addAlertTag(HashMap hashmap, String s, String s1) {
   hashmap.put(s, s1);
   if (!Action.isBaseEntry(s)) {
     String s2 = TextUtils.getValue(hashmap, "extraCount");
     if (s2.length() == 0) s2 = "0";
     s2 = TextUtils.increment(s2);
     hashmap.put("extra" + s2, s);
     hashmap.put("extraCount", s2);
   }
 }
Exemplo n.º 5
0
 static {
   nMaxCounters = 60;
   nMaxCounters =
       TextUtils.toInt(
           TextUtils.getValue(MasterConfig.getMasterConfig(), "_browsableContentMaxCounters"));
   if (nMaxCounters == 0) {
     nMaxCounters = 60;
   }
   pHostName = new StringProperty("_server", "");
   pHostName.setDisplayText("Server name", "the IPMI server name or IP address");
   pHostName.setParameterOptions(false, 1, false);
   pPortNumber = new StringProperty("_port", "623");
   pPortNumber.setDisplayText(
       "Port number", "the port number of the IPMI server (default is 623)");
   pPortNumber.setParameterOptions(false, 2, false);
   pUserName = new StringProperty("_user", "");
   pUserName.setDisplayText("User name", "user name to connect the IPMI server");
   pUserName.setParameterOptions(false, 3, false);
   pPassword = new StringProperty("_password", "");
   pPassword.setDisplayText("Password", "password to connect the IPMI server");
   pPassword.setParameterOptions(false, 4, false);
   pPassword.isPassword = true;
   chassisMericsMap = new Hashtable();
   chassisMericsMap.put("ChassisPowerOn", "Power On");
   chassisMericsMap.put("ChassisPowerOverload", "Power Overload");
   chassisMericsMap.put("ChassisPowerInterlock", "Power Interlock");
   chassisMericsMap.put("ChassisPowerFault", "Power Fault");
   chassisMericsMap.put("ChassisPowerControlFault", "Power Control Fault");
   chassisMericsMap.put("ChassisDriveFault", "Drive Fault");
   chassisMericsMap.put("ChassisCoolingFanFault", "Cooling Fan Fault");
   chassisMericsMap.put("ChassisIntrusion", "Chassis Intrusion");
   chassisMericsMap.put("ChassisFrontPanelLockout", "Front-Panel Lockout");
   pStatus = new StringProperty("status", "n/a");
   String s = (COM.dragonflow.StandardMonitor.IPMIMonitor.class).getName();
   StringProperty astringproperty[] = BrowsableBase.staticInitializer(nMaxCounters, true);
   StringProperty astringproperty1[] = new StringProperty[astringproperty.length + 5];
   System.arraycopy(astringproperty, 0, astringproperty1, 0, astringproperty.length);
   astringproperty1[astringproperty.length] = pHostName;
   astringproperty1[astringproperty.length + 1] = pPortNumber;
   astringproperty1[astringproperty.length + 2] = pUserName;
   astringproperty1[astringproperty.length + 3] = pPassword;
   astringproperty1[astringproperty.length + 4] = pStatus;
   addProperties(s, astringproperty1);
   setClassProperty(s, "description", "Collect IPMI data");
   setClassProperty(s, "help", "IPMIMonitor.htm");
   setClassProperty(s, "title", "IPMI");
   setClassProperty(s, "class", "IPMIMonitor");
   setClassProperty(s, "topazType", "IPMI");
   setClassProperty(s, "classType", "application");
   addClassElement(s, Rule.stringToClassifier("status == 'Error'\terror"));
   addClassElement(s, Rule.stringToClassifier("status == 'Warning'\twarning"));
   addClassElement(s, Rule.stringToClassifier("status == 'OK'\tgood"));
   setClassProperty(s, "target", "_server");
 }
Exemplo n.º 6
0
  private static ArrayList internalGetViewArray(boolean flag, boolean flag1, boolean flag2) {
    ArrayList array = getViews();
    ArrayList array1 = new ArrayList();
    for (int i = 0; i < array.size(); i++) {
      HashMap hashmap = (HashMap) array.get(i);
      if (!flag1 && TextUtils.getValue(hashmap, "_parent").length() > 0) {
        continue;
      }
      String s = TextUtils.getValue(hashmap, "_package");
      if (s.length() == 0) {
        array1.add(TextUtils.getValue(hashmap, "_id"));
        array1.add(TextUtils.getValue(hashmap, "_title"));
        continue;
      }
      if (!flag) {
        continue;
      }
      String s1 = TextUtils.getValue(hashmap, "_parentID");
      String s2 = TextUtils.getValue(hashmap, "_id");
      if (s1.equalsIgnoreCase("") && !s2.endsWith("-")) {
        array1.add(TextUtils.getValue(hashmap, "_id"));
        array1.add(TextUtils.getValue(hashmap, "_title") + " (in " + s + " package)");
      }
    }

    return array1;
  }
Exemplo n.º 7
0
  public static HashMap getView(String s) {
    ArrayList array = getViews();
    for (int i = 0; i < array.size(); i++) {
      HashMap hashmap = (HashMap) array.get(i);
      if (TextUtils.getValue(hashmap, "_id").equalsIgnoreCase(s)) {
        return hashmap;
      }
      if (TextUtils.getValue(hashmap, "_title").equalsIgnoreCase(s)) {
        return hashmap;
      }
    }

    return null;
  }
Exemplo n.º 8
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;
  }
Exemplo n.º 9
0
  public static void saveMG(String groupId, Array data, String s, boolean flag, boolean flag1)
      throws Exception {

    Enumeration<?> enumeration = data.elements();
    while (enumeration.hasMoreElements()) {
      HashMap hashMap = (HashMap) enumeration.nextElement();

      // Object nextID =  hashMap.get("_nextID");
      // if (nextID == null) continue;
      saveGroup(groupId, FILENAME_EXT_MG, hashMap);
      break;
    }

    // enumeration = data.elements();
    List<String> subgroups = new ArrayList<String>();
    while (enumeration.hasMoreElements()) {
      HashMap hashMap = (HashMap) enumeration.nextElement();

      String _class = (String) hashMap.get("_class");
      if (_class == null) continue;
      if ("SubGroup".equals(_class)) {
        subgroups.add(TextUtils.getValue(hashMap, "_group"));
        continue;
      }
      Object id = getId(hashMap);
      if (id == null) continue;
      MonitorEntity.save(groupId, FILENAME_EXT_MG, (String) id, hashMap);
    }
    updateSubGroup(groupId, subgroups, FILENAME_EXT_MG);
  }
Exemplo n.º 10
0
 void loadPortalSiteView(HashMap hashmap) {
   LogManager.log("RunMonitor", "loading SiteView server " + TextUtils.getValue(hashmap, "_id"));
   PortalSiteView portalsiteview = new PortalSiteView();
   portalsiteview.readFromHashMap(hashmap);
   portalsiteview.initialize(hashmap);
   addElement(portalsiteview);
 }
Exemplo n.º 11
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;
    }
  }
Exemplo n.º 12
0
 /**
  * @param monitorgroup
  * @param portalsiteview
  */
 void processGroup(MonitorGroup monitorgroup, PortalSiteView portalsiteview) {
   boolean flag = visitor.groupPre(monitorgroup, portalsiteview);
   if (flag) {
     if (addAlerts) {
       Array array = monitorgroup.getElementsOfClass("COM.dragonflow.SiteView.Rule", false, false);
       Rule rule;
       for (Enumeration enumeration1 = array.elements();
           enumeration1.hasMoreElements();
           processAlert(rule, null, monitorgroup, portalsiteview)) {
         rule = (Rule) enumeration1.nextElement();
       }
     }
     Enumeration enumeration = monitorgroup.getMonitors();
     while (enumeration.hasMoreElements()) {
       Monitor monitor = (Monitor) enumeration.nextElement();
       if (itemFilter.itemAllowed(monitor.getFullID()) && itemFilter.monitorAllowed(monitor)) {
         if (debug) {
           Monitor _tmp = monitor;
           TextUtils.debugPrint("process monitor: " + monitor.getProperty(Monitor.pName));
         }
         processMonitor(monitor, monitorgroup, portalsiteview);
       }
     }
   }
   visitor.groupPost(monitorgroup, portalsiteview);
 }
Exemplo n.º 13
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;
  }
Exemplo n.º 14
0
 static {
   HashMap hashmap = MasterConfig.getMasterConfig();
   StringProperty astringproperty[] = new StringProperty[0];
   addProperties("COM.dragonflow.StandardMonitor.IPlanetWSMonitor", astringproperty);
   addClassElement(
       "COM.dragonflow.StandardMonitor.IPlanetWSMonitor",
       Rule.stringToClassifier("countersInError > 0\terror"));
   addClassElement(
       "COM.dragonflow.StandardMonitor.IPlanetWSMonitor", Rule.stringToClassifier("always\tgood"));
   setClassProperty(
       "COM.dragonflow.StandardMonitor.IPlanetWSMonitor",
       "description",
       "Monitors IPlanet Web servers using snmp.");
   setClassProperty("COM.dragonflow.StandardMonitor.IPlanetWSMonitor", "help", "IPWSMon.htm");
   setClassProperty(
       "COM.dragonflow.StandardMonitor.IPlanetWSMonitor", "title", "IPlanet Web Server");
   setClassProperty(
       "COM.dragonflow.StandardMonitor.IPlanetWSMonitor", "class", "IPlanetWSMonitor");
   setClassProperty("COM.dragonflow.StandardMonitor.IPlanetWSMonitor", "target", "_server");
   setClassProperty(
       "COM.dragonflow.StandardMonitor.IPlanetWSMonitor", "topazName", "IPlanet Web Server");
   setClassProperty("COM.dragonflow.StandardMonitor.IPlanetWSMonitor", "classType", "application");
   setClassProperty("COM.dragonflow.StandardMonitor.IPlanetWSMonitor", "topazType", "Web Server");
   if (TextUtils.getValue(hashmap, "_allowIPlanet").length() > 0) {
     setClassProperty("COM.dragonflow.StandardMonitor.IPlanetWSMonitor", "loadable", "true");
   } else {
     setClassProperty("COM.dragonflow.StandardMonitor.IPlanetWSMonitor", "loadable", "false");
   }
 }
Exemplo n.º 15
0
 private static void portalAssert(boolean flag, String s) {
   if (!flag) {
     System.out.println("ASSERT FAILED: " + s);
     LogManager.log("Error", "ASSERT FAILED: " + s);
     TextUtils.debugPrintStackTrace();
   }
 }
Exemplo n.º 16
0
 public static void readExtraItems(String s, ArrayList array) throws IOException {
   File file = new File(Platform.getRoot() + File.separator + "templates.view");
   if (!file.exists()) {
     return;
   }
   String as[] = file.list();
   if (as == null) {
     return;
   }
   for (int i = 0; i < as.length; i++) {
     File file1 = new File(file, as[i]);
     if (!file1.isDirectory()) {
       continue;
     }
     File file2 = new File(file1, s);
     if (!file2.exists()) {
       continue;
     }
     ArrayList array1 = FrameFile.readFromFile(file2.getAbsolutePath());
     for (int j = 0; j < array1.size(); j++) {
       HashMap hashmap = (HashMap) array1.get(j);
       String s1 = TextUtils.getValue(hashmap, "_id");
       s1 = file1.getName() + "-" + s1;
       hashmap.put("_id", s1);
       hashmap.put("_package", as[i]);
       array.add(hashmap);
     }
   }
 }
Exemplo n.º 17
0
 static {
   exePath =
       Platform.getRoot() + File.separator + "bin" + File.separator + "ss_mon_single_run.exe ";
   nMaxCounters = 30;
   HashMap hashmap = MasterConfig.getMasterConfig();
   nMaxCounters = TextUtils.toInt(TextUtils.getValue(hashmap, "_DispatcherMaxCounters"));
   if (nMaxCounters <= 0) {
     nMaxCounters = 30;
   }
   StringProperty astringproperty[] = BrowsableBase.staticInitializer(nMaxCounters, true);
   exeTimeout = TextUtils.toInt(TextUtils.getValue(hashmap, "_browsableExeTimeout"));
   if (exeTimeout <= 0) {
     exeTimeout = 45000;
   }
   String s = (COM.dragonflow.SiteView.BrowsableExeBase.class).getName();
   addProperties(s, astringproperty);
 }
Exemplo n.º 18
0
 public String getPropertyName(StringProperty stringproperty) {
   String s = stringproperty.getName();
   String s1 = TextUtils.getValue(getLabels(), stringproperty.getLabel());
   if (s1.length() == 0) {
     s1 = s;
   }
   return s1;
 }
Exemplo n.º 19
0
  static {
    HashMap hashmap = MasterConfig.getMasterConfig();
    nMaxCounters = TextUtils.toInt(TextUtils.getValue(hashmap, "_J2EEReportMonitorMaxCounters"));
    if (nMaxCounters <= 0) {
      nMaxCounters = 1000;
    }
    String s = TextUtils.getValue(hashmap, "_J2EEReportMonitorSendZeroCounters");
    if (s.equalsIgnoreCase("false") || s.equalsIgnoreCase("0") || s.length() == 0) {
      sendZeroCounters = false;
    } else {
      sendZeroCounters = true;
    }
    Array array = new Array();
    StringProperty astringproperty[] = new StringProperty[array.size()];
    for (int i = 0; i < array.size(); i++) {
      astringproperty[i] = (StringProperty) array.at(i);
    }

    addProperties("COM.dragonflow.StandardMonitor.J2EEReportMonitor", astringproperty);
    addClassElement(
        "COM.dragonflow.StandardMonitor.J2EEReportMonitor",
        Rule.stringToClassifier("status != OK\terror"));
    addClassElement(
        "COM.dragonflow.StandardMonitor.J2EEReportMonitor",
        Rule.stringToClassifier("always\tgood"));
    setClassProperty(
        "COM.dragonflow.StandardMonitor.J2EEReportMonitor", "description", "Monitor J2EE systems.");
    setClassProperty(
        "COM.dragonflow.StandardMonitor.J2EEReportMonitor", "help", "J2EEReportMon.htm");
    setClassProperty("COM.dragonflow.StandardMonitor.J2EEReportMonitor", "title", "J2EE (Report)");
    setClassProperty(
        "COM.dragonflow.StandardMonitor.J2EEReportMonitor", "class", "J2EEReportMonitor");
    setClassProperty("COM.dragonflow.StandardMonitor.J2EEReportMonitor", "target", "_target");
    setClassProperty(
        "COM.dragonflow.StandardMonitor.J2EEReportMonitor", "topazName", "J2EE (Report)");
    setClassProperty(
        "COM.dragonflow.StandardMonitor.J2EEReportMonitor", "classType", "application");
    setClassProperty(
        "COM.dragonflow.StandardMonitor.J2EEReportMonitor", "topazType", "Web Application Server");
    if (LUtils.isValidSSforXLicense(new J2EEDummyMonitor())) {
      setClassProperty("COM.dragonflow.StandardMonitor.J2EEReportMonitor", "loadable", "true");
    } else {
      setClassProperty("COM.dragonflow.StandardMonitor.J2EEReportMonitor", "loadable", "false");
    }
  }
Exemplo n.º 20
0
 public String verify(
     StringProperty stringproperty, String s, HTTPRequest httprequest, HashMap hashmap) {
   if (stringproperty == pFrequency) {
     HashMap hashmap1 = MasterConfig.getMasterConfig();
     int i = TextUtils.toInt(TextUtils.getValue(hashmap1, "_J2EEReportMonitorMinRefreshTime"));
     if (i < 15) {
       i = 300;
     }
     String s1 = httprequest.getValue(stringproperty.getName() + "Units");
     int j = FrequencyProperty.toSeconds(TextUtils.toInt(s), s1);
     if (j < i && j != 0) {
       hashmap.put(stringproperty, j + "  was less than " + i + " seconds");
     }
     return Integer.toString(j);
   } else {
     return super.verify(stringproperty, s, httprequest, hashmap);
   }
 }
Exemplo n.º 21
0
 String getParameters() {
   String s = I18N.toDefaultEncoding(getProperty("_parameters"));
   if (TextUtils.isSubstituteExpression(s)) {
     s = TextUtils.substitute(s);
   }
   s = createFromTemplate(s);
   if (TextUtils.hasChars(s, "`;&|<>")) {
     LogManager.log(
         "Error",
         "Removed illegal characters from script monitor parameters \""
             + s
             + "\""
             + " for monitor "
             + getProperty(pName));
     s = TextUtils.removeChars(s, "`;&|<>");
   }
   return s;
 }
Exemplo n.º 22
0
 public String verify(
     StringProperty stringproperty, String s, HTTPRequest httprequest, HashMap hashmap) {
   if (stringproperty == pParameters) {
     if (TextUtils.hasChars(s, "`;&")) {
       hashmap.put(stringproperty, "script parameters have illegal characters");
     }
   } else if (stringproperty == pExpression) {
     String s1 = TextUtils.legalMatchString(s);
     if (s1.length() > 0) {
       hashmap.put(stringproperty, s1);
     }
   } else if (stringproperty == pLocalScriptLocation) {
     String s2 = getProperty(pLocalScriptLocation);
     if (s2.length() == 0) {
       hashmap.put(stringproperty, "Specified local Scripts location must be non zero-length");
     }
   }
   return super.verify(stringproperty, s, httprequest, hashmap);
 }
Exemplo n.º 23
0
  public static ArrayList internalGetQueryArray(boolean flag) {
    ArrayList array = getQueries();
    ArrayList array1 = new ArrayList();
    for (int i = 0; i < array.size(); i++) {
      HashMap hashmap = (HashMap) array.get(i);
      String s = TextUtils.getValue(hashmap, "_package");
      if (s.length() == 0) {
        array1.add(TextUtils.getValue(hashmap, "_id"));
        array1.add(TextUtils.getValue(hashmap, "_title"));
        continue;
      }
      if (flag) {
        array1.add(TextUtils.getValue(hashmap, "_id"));
        array1.add(TextUtils.getValue(hashmap, "_title") + " (in " + s + " package)");
      }
    }

    return array1;
  }
Exemplo n.º 24
0
 private static boolean useStatusAndRoundtrip() {
   if (useStatusAndRoundtrip == 0) {
     useStatusAndRoundtrip =
         TextUtils.getValue(MasterConfig.getMasterConfig(), "_scriptMonitorUseStatusAndRoundtrip")
                 .equalsIgnoreCase("false")
             ? -1
             : 1;
   }
   return useStatusAndRoundtrip != -1;
 }
Exemplo n.º 25
0
 public String GetPropertyLabel(StringProperty stringproperty, boolean flag) {
   String s = stringproperty.printString();
   String s1 = TextUtils.getValue(getLabels(), s);
   if (s1.length() != 0) {
     return s1;
   }
   if (flag) {
     return "";
   } else {
     return s;
   }
 }
Exemplo n.º 26
0
 /**
  * CAUTION: Decompiled by hand.
  *
  * @param hashmap
  * @param array
  * @param hashmap1
  */
 public void addAlertEntry(HashMap hashmap, ArrayList array, HashMap hashmap1) {
   if (hashmap1 != null) {
     Enumeration enumeration = hashmap1.keys();
     Object obj = null;
     String s1 = null;
     while (enumeration.hasMoreElements()) {
       String s = (String) enumeration.nextElement();
       if (!s.equals(s1)) {
         String s2 = "";
         s2 = TextUtils.getValue(hashmap, s);
         if (s.equals("alert-type")) {
           String s3 = TextUtils.getValue(hashmap, "alert-id");
           s2 = TextUtils.readStringFromEnd(s3, ":");
         } else if (s.equals("alert-id")) s2 = TextUtils.readStringFromStart(s2, ":");
         else if (s.equals("alert-monitor-id")) s2 = TextUtils.readStringFromStart(s2, ":");
         if (hashmap1.countValues(s2) > 0) array.add(hashmap);
         s1 = s;
       }
     }
   }
 }
Exemplo n.º 27
0
 public static String getViewContent(String s, HTTPRequest httprequest) {
   String s1 = "";
   String s2 =
       Platform.getUsedDirectoryPath("templates.view", httprequest.getAccount())
           + File.separator
           + s;
   try {
     s1 = FileUtils.readFile(s2).toString();
     s1 =
         TextUtils.replaceString(
             s1, "account=administrator", "account=" + httprequest.getAccount());
     s1 =
         TextUtils.replaceString(
             s1,
             "name=\"account\" value=\"administrator\"",
             "name=\"account\" value=\"" + httprequest.getAccount() + "\"");
   } catch (IOException ioexception) {
     LogManager.log("Error", "Could not read view file " + s2);
   }
   return s1;
 }
Exemplo n.º 28
0
 static {
   centrascopeDebug = 0;
   StringProperty astringproperty[] = new StringProperty[0];
   addProperties("COM.dragonflow.SiteView.Portal", astringproperty);
   String s = System.getProperty("CentraScope.debug");
   if (s != null) {
     centrascopeDebug = TextUtils.toInt(s);
     System.out.println("centrascopeDebug=" + centrascopeDebug);
   }
   PORTAL_SERVERS_CONFIG_PATH =
       Platform.getRoot() + File.separator + "groups" + File.separator + "portal.config";
 }
Exemplo n.º 29
0
  public static Vector getTemplateList(String s) {
    Vector vector = new Vector();
    vector.addElement("");
    vector.addElement("none");
    String s1 = Platform.getRoot() + "/groups/" + TEMPLATES_FILE;
    if (s.length() > 0) {
      s = Portal.cleanPortalServerID(s);
      s1 = Portal.getPortalSiteViewRootPath(s) + "/groups/" + TEMPLATES_FILE;
    }
    try {
      Array array = FrameFile.readFromFile(s1);
      for (int i = 1; i < array.size(); i++) {
        HashMap hashmap = (HashMap) array.at(i);
        vector.addElement(TextUtils.getValue(hashmap, "__id"));
        vector.addElement(TextUtils.getValue(hashmap, "__name"));
      }

    } catch (IOException e) {
      /* empty */
    }
    return vector;
  }
 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;
 }