public String verify(
     StringProperty stringproperty, String s, HTTPRequest httprequest, HashMap hashmap) {
   if (stringproperty == getPDuration()) {
     long l = Long.parseLong(s);
     if (s.trim().length() == 0) {
       hashmap.put(stringproperty, stringproperty.getLabel() + " missing");
     } else if (l <= 0L) {
       hashmap.put(
           stringproperty,
           stringproperty.getLabel() + " duration must be positive value (milleseconds).");
     }
     return s;
   }
   if (stringproperty == getCountersProperty()) {
     String s1 = getCountersContent();
     if (s1.length() <= 0) {
       hashmap.put(stringproperty, "No counters selected");
     }
     return s;
   }
   if (stringproperty == getPMediaURL()) {
     return s;
   } else {
     return super.verify(stringproperty, s, httprequest, hashmap);
   }
 }
Exemple #2
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);
  }
Exemple #3
0
 jgl.Array getCustomCache(String s) {
   jgl.Array array = (jgl.Array) customCaches.get(s);
   if (array == null) {
     array = new Array();
     customCaches.put(s, array);
   }
   return array;
 }
 public synchronized Enumeration getMultipleValues(StringProperty stringproperty) {
   jgl.HashMap hashmap = findTable(stringproperty);
   if (hashmap != null) {
     return hashmap.values(stringproperty);
   } else {
     return cEmptyArray.elements();
   }
 }
 public boolean hasValue(StringProperty stringproperty) {
   HashMap hashmap = findTable(stringproperty);
   if (hashmap == null) {
     return false;
   } else {
     return hashmap.count(stringproperty) > 0;
   }
 }
 public synchronized void resetFileTimeStamp(String s) {
   String s1 = (new File(s)).getAbsolutePath();
   Long long1 = (Long) fileNameMap.get(s1);
   if (long1 != null) {
     fileNameMap.remove(s1);
     fileNameMap.put(s1, new Long(0L));
   }
 }
 public Object getClassProperty(String s) {
   jgl.HashMap hashmap = getClassPropertyTable();
   if (hashmap == null) {
     return null;
   } else {
     return hashmap.get(s);
   }
 }
  private void startXmlElement(String s, jgl.HashMap hashmap) {
    boolean flag = false;
    java.util.Vector vector = null;
    xmlResponse.append("<" + s);
    if (hashmap != null) {
      java.util.Enumeration enumeration = hashmap.keys();
      while (enumeration.hasMoreElements()) {
        String s1 = enumeration.nextElement().toString();
        Object obj = hashmap.get(s1);
        if (obj instanceof String[]) {
          flag = true;
          if (vector == null) {
            vector = new Vector();
          }
          vector.addElement(s1);
        } else if (obj instanceof String) {
          if (com.dragonflow.Utils.I18N.isNullEncoding(obj.toString())) {
            xmlResponse.append(
                " "
                    + s1
                    + "=\""
                    + com.dragonflow.Utils.TextUtils.escapeHTML(
                        com.dragonflow.Utils.I18N.toDefaultEncoding(obj.toString()))
                    + "\"");
          } else {
            xmlResponse.append(
                " "
                    + s1
                    + "=\""
                    + com.dragonflow.Utils.TextUtils.escapeHTML(obj.toString())
                    + "\"");
          }
        }
      }
      xmlResponse.append(">\r\n");
      if (flag) {
        for (int i = 0; i < vector.size(); i++) {
          String s2 = (String) vector.elementAt(i);
          String as[] = (String[]) hashmap.get(s2);
          xmlResponse.append("<property>\r\n");
          xmlResponse.append(s2 + "\r\n");
          for (int j = 0; j < as.length; j++) {
            if (as[j] == null) {
              continue;
            }
            if (encodeValues) {
              String s3 = com.dragonflow.XmlApi.XmlApiRequestXML.escapeXML(as[j]);
              xmlResponse.append("<value>" + s3 + "</value>\r\n");
            } else {
              xmlResponse.append("<value>" + as[j] + "</value>\r\n");
            }
          }

          xmlResponse.append("</property>\r\n");
        }
      }
    }
  }
 static void resolveTemplateReferences(HashMap hashmap) {
   if (hashmap != null) {
     HashMap hashmap1;
     for (Enumeration enumeration = hashmap.keys();
         enumeration.hasMoreElements();
         resolveTemplateReferences(hashmap, hashmap1, 0, hashmap.size()))
       hashmap1 = (HashMap) hashmap.get(enumeration.nextElement());
   }
 }
 protected void addToMonitorList(Monitor monitor, Array array, HashMap hashmap) {
   if (monitor == this) {
     return;
   }
   String s = monitor.getProperty(pGroupID) + " " + monitor.getProperty(pID);
   if (hashmap.get(s) == null) {
     hashmap.put(s, monitor);
     array.add(monitor);
   }
 }
Exemple #11
0
 void saveAddProperties(String s, jgl.HashMap hashmap, String s1) {
   hashmap.put(
       com.dragonflow.SiteView.Machine.pSshAuthMethod.getName(),
       request.getValue(SSH_AUTH_METHOD_FORM_VARIABLE));
   hashmap.put(
       com.dragonflow.SiteView.Machine.pSshKeyFile.getName(),
       request.getValue(KEYFILE_FORM_VARIABLE));
   hashmap.put(
       com.dragonflow.SiteView.Machine.pSSHClient.getName(),
       request.getValue(SSH_CLIENT_METHOD_VARIABLE));
   hashmap.put(
       com.dragonflow.SiteView.Machine.pSSHForceVersion2.getName(),
       request.getValue(FORCE_VERSION2_FORM_VARIABLE));
   hashmap.put(
       com.dragonflow.SiteView.Machine.pSSHConnectionCaching.getName(),
       request.getValue(DISABLE_CACHE_FORM_VARIABLE));
   hashmap.put(
       com.dragonflow.SiteView.Machine.pSSHConnectionsLimit.getName(),
       request.getValue(CONNECTIONS_LIMIT));
   hashmap.put(
       com.dragonflow.SiteView.Machine.pSSHCommandLine.getName(),
       request.getValue(COMMAND_LINE_FORM_VARIABLE));
   hashmap.put(
       com.dragonflow.SiteView.Machine.pSSHPort.getName(), request.getValue(PORT_FORM_VARIABLE));
   String s2 = request.getValue(PASSWORD_FORM_VARIABLE);
   if (!s2.equals(DEFAULT_PASSWORD)) {
     hashmap.put(com.dragonflow.SiteView.Machine.pPassword.getName(), s2);
   }
 }
Exemple #12
0
 static {
   defaultDisplayUnits = new HashMap();
   unitDisplayName = new HashMap();
   unitConversionTable = new HashMap();
   defaultDisplayUnits.add("milliseconds", "seconds");
   unitDisplayName.add("milliseconds", "ms");
   unitDisplayName.add("seconds", "sec");
   unitDisplayName.add("minutes", "min");
   unitConversionTable.add("milliseconds to seconds", new Float(0.001D));
   unitConversionTable.add("seconds to milliseconds", new Float(1000F));
 }
Exemple #13
0
  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 boolean hasValue(String s) {
   StringProperty stringproperty = getPropertyObject(s);
   if (stringproperty != null) {
     return hasValue(stringproperty);
   }
   HashMap hashmap = findTable(s);
   if (hashmap == null) {
     return false;
   } else {
     return hashmap.count(s) > 0;
   }
 }
 synchronized HashMap getLabels() {
   if (labelsCache == null) {
     labelsCache = new HashMap();
     if (getProperty(pValueLabels).length() > 0) {
       String s = getProperty(pValueLabels);
       labelsCache.add("Result", s);
     } else {
       labelsCache.add("Result", "Result");
     }
   }
   return labelsCache;
 }
Exemple #16
0
  void closeConnection() {
    COM.dragonflow.Log.LogManager.log("RunMonitor", "jdbc log, closing database connection");
    if (logStatementCache != null) {
      try {
        logStatementCache.close();
        logStatementCache = null;
      } catch (java.lang.Exception exception) {
        COM.dragonflow.Log.LogManager.log(
            "RunMonitor", "jdbc logger error: closing statement, " + exception);
        COM.dragonflow.Log.LogManager.log(
            "Error", "jdbc logger error: closing statement, " + exception);
      }
    }
    if (linkStatementCache != null) {
      try {
        linkStatementCache.close();
        linkStatementCache = null;
      } catch (java.lang.Exception exception1) {
        COM.dragonflow.Log.LogManager.log(
            "RunMonitor", "jdbc logger error: closing link statement, " + exception1);
        COM.dragonflow.Log.LogManager.log(
            "Error", "jdbc logger error: closing link statement, " + exception1);
      }
    }
    for (Enumeration enumeration = customStatements.keys(); enumeration.hasMoreElements(); ) {
      String s = (String) enumeration.nextElement();
      java.sql.PreparedStatement preparedstatement =
          (java.sql.PreparedStatement) customStatements.get(s);
      try {
        preparedstatement.close();
        customStatements.remove(s);
        COM.dragonflow.Log.LogManager.log("RunMonitor", "jdbc logger, closed " + s);
      } catch (java.lang.Exception exception3) {
        COM.dragonflow.Log.LogManager.log(
            "RunMonitor", "jdbc logger error, closing " + s + ", " + exception3);
        COM.dragonflow.Log.LogManager.log(
            "Error", "jdbc logger error: closing " + s + ", " + exception3);
      }
    }

    if (connection != null) {
      try {
        connection.close();
        connection = null;
      } catch (java.lang.Exception exception2) {
        COM.dragonflow.Log.LogManager.log(
            "RunMonitor", "jdbc logger error: closing, " + exception2);
        COM.dragonflow.Log.LogManager.log("Error", "jdbc logger error: closing, " + exception2);
      }
    }
    COM.dragonflow.Log.LogManager.log("RunMonitor", "jdbc log, closed");
  }
 public long getStartPosition(long endPosition, String logName) {
   String value = getValue("_resetFile");
   if (value == null || value.length() == 0 || value.equals("none")) {
     return super.getStartPosition(endPosition, logName);
   }
   if (getValue("_resetFile").equals("once")) {
     HashMap map = new HashMap();
     map.put(getResetFileProperty().getName(), "none");
     setProperty(getResetFileProperty(), "none");
     saveMonitor(map);
   }
   return 0L;
 }
 public synchronized Enumeration getMultipleValues(String s) {
   if (valuesTable != null) {
     StringProperty stringproperty = getPropertyObject(s);
     if (stringproperty != null) {
       return getMultipleValues(stringproperty);
     }
     HashMap hashmap = findTable(s);
     if (hashmap != null) {
       return hashmap.values(s);
     }
   }
   return cEmptyArray.elements();
 }
 public Array getProperties(StringProperty stringproperty) throws NullPointerException {
   jgl.Array array = new Array();
   jgl.HashMap hashmap = findTable(stringproperty);
   if (hashmap != null) {
     Object obj = hashmap.get(stringproperty);
     if (obj != null && (obj instanceof Array)) {
       array = (Array) obj;
     } else if (obj != null) {
       array.add(obj);
     }
   }
   return array;
 }
Exemple #20
0
 public long getStartPosition(long l, String s) {
   String s1 = getValue("_resetFile");
   if (s1 == null || s1.length() == 0 || s1.equals("none")) {
     return super.getStartPosition(l, s);
   }
   if (getValue("_resetFile").equals("once")) {
     HashMap hashmap = new HashMap();
     hashmap.put(pResetFile.getName(), "none");
     setProperty(pResetFile, "none");
     saveMonitor(hashmap);
   }
   return 0L;
 }
  private void processNode(org.w3c.dom.Node node, com.dragonflow.XmlApi.XmlApiObject xmlapiobject) {
    if (node.getNodeType() == 1) {
      String s = node.getNodeName();
      if (s != null && s.length() > 0) {
        jgl.HashMap hashmap = new HashMap();
        org.w3c.dom.NamedNodeMap namednodemap = node.getAttributes();
        for (int i = 0; i < namednodemap.getLength(); i++) {
          org.w3c.dom.Attr attr = (org.w3c.dom.Attr) namednodemap.item(i);
          if (attr.getName() != null
              && attr.getName().equals("encodeValues")
              && attr.getValue() != null
              && (attr.getValue().equals("false") || attr.getValue().equals("true"))) {
            encodeValues = (new Boolean(attr.getValue())).booleanValue();
            continue;
          }
          String s1 = attr.getValue();
          if (s1 != null) {
            s1 = com.dragonflow.Utils.TextUtils.enlighten(s1);
          }
          hashmap.put(attr.getName(), s1);
        }

        org.w3c.dom.NodeList nodelist = node.getChildNodes();
        java.util.Vector vector = findPropNodes(nodelist);
        for (int j = 0; j < vector.size(); j++) {
          org.w3c.dom.Node node1 = (org.w3c.dom.Node) vector.elementAt(j);
          org.w3c.dom.NodeList nodelist1 = node1.getChildNodes();
          String s2 = findPropertyName(nodelist1);
          String as[] = findValueNodes(nodelist1);
          if (as.length > 1) {
            hashmap.put(s2, as);
            continue;
          }
          if (as.length == 1) {
            hashmap.put(s2, as[0]);
          } else {
            hashmap.put(s2, "");
          }
        }

        xmlapiobject.setProperties(hashmap);
        xmlapiobject.setName(s);
        java.util.Vector vector1 = findChildrenNodes(nodelist);
        for (int k = 0; k < vector1.size(); k++) {
          org.w3c.dom.Node node2 = (org.w3c.dom.Node) vector1.elementAt(k);
          processNode(node2, xmlapiobject.add());
        }
      }
    }
  }
Exemple #22
0
 void printForm(String s, jgl.Array array, jgl.HashMap hashmap) throws Exception {
   String s1 = "";
   String s2 = getMachineID();
   String s3 = com.dragonflow.Page.remoteBase.getSubmitName(s);
   String s4 = request.getValue("storeID");
   jgl.HashMap hashmap1;
   if (s.equals("Edit")) {
     hashmap1 = findMachine(array, s2);
     s1 = s3 + " Remote Server : " + hashmap1.get("_name");
   } else {
     hashmap1 = new HashMap();
     String s5 = request.getValue("host");
     hashmap1.put("_host", s5);
     s1 = s3 + " Remote Server";
   }
   printBodyHeader(s1);
   printButtonBar(getHelpPage(), "");
   outputStream.println("<p><H2>" + s1 + "</H2>\n");
   outputStream.println(getPagePOST(getPage(), s));
   outputStream.println(
       "<input type=hidden name=backURL value=\""
           + request.getValue("backURL")
           + "\">\n"
           + "<input type=hidden name=backLabel value=\""
           + request.getValue("backLabel")
           + "\">");
   if (s.equals("Edit")) {
     outputStream.println("<input type=hidden name=" + getIDName() + " value=" + s2 + ">");
   }
   outputStream.println(getReturnLink(true, s4));
   outputStream.println("<TABLE>");
   boolean flag = displayFormTable(hashmap1, s);
   outputStream.println("</TABLE>");
   if (flag) {
     outputStream.println(
         "<TABLE WIDTH=100%><TR><TD>"
             + getReturnLink(true, s4)
             + "<input type=submit value=\""
             + s3
             + "\"> "
             + getPrintFormSubmit()
             + "\n"
             + "</TD></TR></TABLE>");
   } else {
     printBackLink();
   }
   printFooter(outputStream);
 }
Exemple #23
0
  public static void saveDYN(String groupId, Array data, String s, boolean flag, boolean flag1)
      throws Exception {
    Enumeration<?> enumeration = data.elements();

    while (enumeration.hasMoreElements()) {
      HashMap hashMap = (HashMap) enumeration.nextElement();

      String id = (String) hashMap.get("id");
      if (id == null) continue;
      if (id.equals("-1")) {
        saveGroup(groupId, FILENAME_EXT_DYN, hashMap);
      } else {
        MonitorEntity.save(groupId, FILENAME_EXT_DYN, (String) id, hashMap);
      }
    }
  }
Exemple #24
0
 public String getUnitDisplayString(String s) {
   String s1 = (String) unitDisplayName.get(s);
   if (s1 == null) {
     return s;
   } else {
     return s1;
   }
 }
Exemple #25
0
 public static Array createHealthGroup() throws SiteViewParameterException {
   String s = Platform.getRoot() + File.separator + "groups" + File.separator + "__Health__.mg";
   File file = new File(s);
   Array array = null;
   if (!file.exists()) {
     array = new Array();
     HashMap hashmap = new HashMap();
     hashmap.put("_encoding", I18N.getDefaultEncoding());
     hashmap.put("_health", "true");
     hashmap.put("_dependsCondition", "good");
     hashmap.put("_fileEncoding", I18N.getDefaultEncoding());
     hashmap.put("_name", "Health");
     hashmap.put("_nextID", "1");
     array.add(hashmap);
     try {
       FrameFile.writeToFile(s, array);
     } catch (IOException ioexception1) {
       String as[] = {"__Health__.mg", ioexception1.getMessage()};
       throw new SiteViewParameterException(SiteViewErrorCodes.ERR_OP_SS_HEALTH_CANNOT_WRITE, as);
     }
   } else {
     try {
       array = FrameFile.readFromFile(s);
     } catch (IOException ioexception) {
       LogManager.log(
           "error", "Couldn't read the Health group. Got Error: " + ioexception.getMessage());
     }
   }
   return array;
 }
 private jgl.HashMap updateSetting(jgl.HashMap hashmap, String s) {
   String s1 = null;
   s1 = request.getValue(s + "CB");
   outputStream.print("<br>Debug->" + s1);
   if (s1.equalsIgnoreCase("on")) {
     String s2 = request.getValue(s);
     outputStream.print("<br>Debug->" + s2);
     if (s2.equalsIgnoreCase("custom")) {
       s2 = request.getValue(s + "Custom");
       outputStream.print("<br>Debug->" + s2);
       hashmap.put(s, s2.toUpperCase());
     } else {
       outputStream.print("<br>Debug->" + s2);
       hashmap.put(s, s2);
     }
   }
   return hashmap;
 }
Exemple #27
0
 java.sql.PreparedStatement getStatement() throws java.lang.Exception {
   if (usingBackupSignalFile && shouldFlush()) {
     boolean flag = shouldUseBackupDatabase();
     if (flag != usingBackupDatabase) {
       closeConnection();
     }
     usingBackupDatabase = flag;
   }
   if (logStatementCache == null) {
     if (reconnectTime != 0L && java.lang.System.currentTimeMillis() < reconnectTime) {
       return null;
     }
     jgl.HashMap hashmap = COM.dragonflow.SiteView.MasterConfig.getMasterConfig();
     String s = COM.dragonflow.Utils.TextUtils.getValue(hashmap, "_logJdbcURL" + logName);
     if (s.length() == 0) {
       return null;
     }
     setupConnection(hashmap, s);
     String s1 = COM.dragonflow.Utils.TextUtils.getValue(hashmap, "_logJdbcInsert" + logName);
     String s2 = COM.dragonflow.Utils.TextUtils.getValue(hashmap, "_logJdbcCreate" + logName);
     method = COM.dragonflow.Utils.TextUtils.getValue(hashmap, "_logJdbcMethod" + logName);
     if (s2.indexOf("serverName") != -1) {
       server = COM.dragonflow.SiteView.SiteViewGroup.getServerID(hashmap);
     }
     String s3 = createTable(connection, s2);
     if (s3.indexOf("invalid column name") != -1) {
       COM.dragonflow.Log.LogManager.log("RunMonitor", "jdbc log, fixup date column, " + s3);
       s2 = COM.dragonflow.Utils.TextUtils.replaceString(s2, "date VAR", "datex VAR");
       hashmap.put("_logJdbcCreate" + logName, s2);
       COM.dragonflow.SiteView.MasterConfig.saveMasterConfig(hashmap);
       s3 = createTable(connection, s2);
     }
     vars = countVars(s1);
     COM.dragonflow.Log.LogManager.log(
         "RunMonitor", "jdbc log, prepare insert, " + vars + ", " + s1);
     if (COM.dragonflow.Utils.TextUtils.startsWithIgnoreCase(s1, "call")) {
       logStatementCache = connection.prepareCall("{" + s1 + "}");
     } else {
       logStatementCache = connection.prepareStatement(s1);
     }
     COM.dragonflow.Log.LogManager.log("RunMonitor", "jdbc log, connected");
   }
   return logStatementCache;
 }
Exemple #28
0
 private static String getId(HashMap hashmap) {
   Object id = hashmap.get("_id");
   if (id != null) return (String) id;
   Enumeration<?> enumeration = hashmap.keys();
   while (enumeration.hasMoreElements()) {
     Object obj = enumeration.nextElement();
     if (obj instanceof StringProperty) {
       String key = ((StringProperty) obj).getName();
       if (key.equals("_id")) {
         Enumeration<?> enumeration1 = hashmap.values(obj);
         while (enumeration1.hasMoreElements()) {
           Object obj1 = enumeration1.nextElement();
           return (String) obj1;
         }
       }
     }
   }
   return null;
 }
Exemple #29
0
 public void flush() {
   flushsafe(logStatementCache, logCache);
   flushsafe(linkStatementCache, linkCache);
   for (Enumeration enumeration = customStatements.keys(); enumeration.hasMoreElements(); ) {
     String s = (String) enumeration.nextElement();
     java.sql.PreparedStatement preparedstatement =
         (java.sql.PreparedStatement) customStatements.get(s);
     jgl.Array array = (jgl.Array) customCaches.get(s);
     try {
       flushsafe(preparedstatement, array);
       COM.dragonflow.Log.LogManager.log("RunMonitor", "jdbc logger, flushed " + s);
     } catch (java.lang.Exception exception) {
       COM.dragonflow.Log.LogManager.log(
           "RunMonitor", "jdbc logger error, closing " + s + ", " + exception);
       COM.dragonflow.Log.LogManager.log(
           "Error", "jdbc logger error: closing " + s + ", " + exception);
     }
   }
 }
  public HashMap getTemplateTable() {
    if (templateID != null && templateTableLastUpdate < templateCacheLastUpdate) {
      templateTable = null;
      if (templateID.length() > 0) {
        if (templateCache == null) {
          templateCache = new HashMap();
          String s = "";
          Array array = getTemplateConfigFileList();
          for (int i = 0; i < array.size(); i++)
            try {
              s = (String) array.at(i);
              HashMap hashmap2 = new HashMap();
              Array array1 = FrameFile.readFromFile(s);
              templateCacheLastUpdate = Platform.timeMillis();
              for (int j = 1; j < array1.size(); j++) {
                HashMap hashmap3 = (HashMap) array1.at(j);
                hashmap2.put(TextUtils.getValue(hashmap3, "__id"), hashmap3);
              }

              resolveTemplateReferences(hashmap2);
              templateCache.add(s, hashmap2);
            } catch (IOException ioexception) {
              LogManager.log("Error", "Could not read template file " + s);
            }
        }
        if (templateCache != null) {
          String s1 = getTemplateConfigFilePath();
          HashMap hashmap = null;
          hashmap = (HashMap) templateCache.get(s1);
          if (hashmap != null) {
            HashMap hashmap1 = (HashMap) hashmap.get(templateID);
            if (hashmap1 != null) {
              templateTable = new HashMapOrdered(true);
              initializeValuesTable(hashmap1, templateTable, true);
            }
          }
        }
      }
      templateTableLastUpdate = Platform.timeMillis();
    }
    return templateTable;
  }