예제 #1
0
  protected String getSshClientHtml(jgl.HashMap hashmap) {
    String s =
        com.dragonflow.Utils.TextUtils.getValue(
            hashmap, com.dragonflow.SiteView.Machine.pSSHClient.getName());
    if (request.getValue("operation").equals("Add")) {
      s = "java";
    } else if (s.length() == 0) {
      s = "plink";
    }
    jgl.Array array = com.dragonflow.SiteView.Machine.getAllowedSshConnectionMethods();
    boolean flag = false;
    for (int i = 0; i < array.size(); i++) {
      if (array.at(i).equals(s)) {
        flag = true;
        break;
      }
    }

    if (!flag) {
      s = "";
    }
    return field(
        "SSH Client",
        "<select name=sshClient size=1>" + com.dragonflow.Page.remoteBase.getOptionsHTML(array, s),
        "Select the client to use to connect to the remote server.");
  }
예제 #2
0
  public synchronized void log(String s, java.util.Date date, String s1) {
    jgl.Array array;
    java.sql.PreparedStatement preparedstatement;
    array = new Array();
    try {
      preparedstatement = getStatement();
      if (preparedstatement == null) {
        return;
      }
      int i = 1;
      if (i < vars) {
        array.add(COM.dragonflow.Log.JdbcLogger.jdbcDateFormat(date));
        i++;
      }
      if (i < vars) {
        array.add(s1);
        i++;
      }
      for (; i <= vars; i++) {
        if (useNulls) {
          array.add(null);
        } else {
          array.add("");
        }
      }

      execute(preparedstatement, logCache, array);
    } catch (java.lang.Exception exception) {
      COM.dragonflow.Log.LogManager.log("RunMonitor", "jdbc logger error: " + exception);
      COM.dragonflow.Log.LogManager.log("Error", "jdbc logger error: " + exception);
      reconnectTime = (long) (reconnectSeconds * 1000) + java.lang.System.currentTimeMillis();
      closeConnection();
    }
    return;
  }
예제 #3
0
 void execute(java.sql.PreparedStatement preparedstatement, jgl.Array array, jgl.Array array1)
     throws java.sql.SQLException {
   array.add(array1);
   if (array.size() > autoCommit) {
     flush(preparedstatement, array);
   }
   autoCommitCounter++;
 }
예제 #4
0
 private jgl.Array parseHosts(String s) {
   jgl.Array array = new Array();
   if (s.indexOf(",") != -1) {
     array = com.dragonflow.Utils.TextUtils.splitArray(s, ",");
   } else {
     array.add(s.trim());
   }
   return array;
 }
예제 #5
0
 protected java.lang.String doRequest(java.lang.String s, boolean flag, java.lang.String s1)
     throws java.lang.Exception {
   if (s == null) {
     throw new Exception("Paramater uri cannot be null");
   }
   com.dragonflow.Utils.SocketSession socketsession =
       com.dragonflow.Utils.SocketSession.getSession(null);
   java.lang.StringBuffer stringbuffer = new StringBuffer(10000);
   java.lang.String s2 = "http://" + getConnID() + s;
   jgl.Array array = null;
   if (s1 != null) {
     array = new Array();
     array.add("Custom-Content: " + s1);
   }
   long al[] =
       com.dragonflow.StandardMonitor.URLMonitor.checkURL(
           socketsession,
           s2,
           null,
           null,
           null,
           null,
           null,
           array,
           null,
           null,
           null,
           stringbuffer,
           0x989680L,
           null,
           0,
           60000,
           null);
   java.lang.String s3 =
       com.dragonflow.StandardMonitor.URLMonitor.getHTTPContent(stringbuffer.toString());
   if (al[0] == 200L) {
     s3 = s3.trim();
     if (s3.startsWith("<") && flag) {
       java.lang.String s5 = s3.substring(0, 50);
       java.lang.String s4;
       if (s3.indexOf("<P>") >= 0) {
         xmlKeys = xmlShortKeys;
         s4 = "J2EEGetListShort.xsl";
       } else {
         xmlKeys = xmlLongKeys;
         s4 = "J2EEGetList.xsl";
       }
       return J2EEConnection.transform(s3, "templates.applications/" + s4);
     } else {
       return s3;
     }
   } else {
     throw new Exception(com.dragonflow.StandardMonitor.URLMonitor.lookupStatus(al[0]));
   }
 }
예제 #6
0
 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;
 }
예제 #7
0
파일: I18N.java 프로젝트: SiteView/ECC8.13
  public static jgl.Array toDefaultArray(jgl.Array array) {
    if (!isI18N) {
      return array;
    }
    jgl.Array array1 = new Array();
    for (int i = 0; i < array.size(); i++) {
      String s = (String) array.at(i);
      com.dragonflow.Utils.I18N.test(s, 1);
      array1.add(com.dragonflow.Utils.I18N.toDefaultEncoding((String) array.at(i)));
    }

    return array1;
  }
예제 #8
0
  private int getIndex(jgl.Array array, jgl.HashMap hashmap) {
    if (com.dragonflow.Utils.TextUtils.getValue(hashmap, "_id").length() == 0) {
      return -1;
    }
    for (int i = 0; i < array.size(); i++) {
      jgl.HashMap hashmap1 = (jgl.HashMap) array.at(i);
      if (com.dragonflow.Utils.TextUtils.getValue(hashmap, "_id")
          .equals(com.dragonflow.Utils.TextUtils.getValue(hashmap1, "_id"))) {
        return i;
      }
    }

    return -1;
  }
예제 #9
0
 void printDeleteForm(String s) throws Exception {
   String s1 = getMachineID();
   String s2 = "ID " + s1;
   jgl.Array array = readMachines(getRemoteName());
   jgl.HashMap hashmap = findMachine(array, s1);
   if (hashmap != null) {
     s2 = com.dragonflow.Utils.TextUtils.getValue(hashmap, "_name");
     if (s2.length() == 0) {
       s2 = com.dragonflow.Utils.TextUtils.getValue(hashmap, "_host");
     }
   }
   if (request.isPost()) {
     try {
       com.dragonflow.SSH.SSHManager.getInstance().deleteRemote(getRemoteUniqueId());
       array.remove(hashmap);
       saveMachines(array, getRemoteName());
       autoFollowPortalRefresh = false;
       printRefreshPage(
           getPageLink(getPage(), "List") + getReturnLink(false, request.getValue("storeID")), 0);
     } catch (Exception exception) {
       printError(
           "There was a problem deleting the remote server.",
           exception.toString(),
           "/SiteView/" + request.getAccountDirectory() + "/SiteView.html");
     }
   } else {
     printBodyHeader("Delete Confirmation");
     outputStream.println(
         "<FONT SIZE=+1>Are you sure you want to delete the remote server <B>"
             + s2
             + "</B>?</FONT>"
             + "<p>"
             + getPagePOST(getPage(), s)
             + "<input type=hidden name="
             + getIDName()
             + " value=\""
             + s1
             + "\">"
             + getReturnLink(true, request.getValue("storeID"))
             + "<TABLE WIDTH=100% BORDER=0><TR>"
             + "<TD WIDTH=6%></TD><TD WIDTH=41%><input type=submit value=\""
             + s
             + "\"></TD>"
             + "<TD WIDTH=6%></TD><TD ALIGN=RIGHT WIDTH=41%><A HREF="
             + getPageLink(getPage(), "List")
             + ">Return to Detail</A></TD><TD WIDTH=6%></TD>"
             + "</TR></TABLE></FORM>");
     printFooter(outputStream);
   }
 }
예제 #10
0
  public static java.lang.String getNameFromArray(jgl.Array array) {
    java.lang.String s = "";
    int i = array.size();
    int j;
    if (array.at(0).equals("All SQL")) {
      j = 1;
    } else {
      j = 0;
    }
    for (int k = i; k > j; k--) {
      if (k < array.size()) {
        s = s + '/';
      }
      s = s + J2EEConnection.escapeString((java.lang.String) array.at(k - 1));
    }

    return s;
  }
예제 #11
0
  /**
   * CAUTION: Decompiled by hand.
   *
   * @param s
   * @return
   * @throws NullPointerException
   */
  public Array getProperties(String s) throws NullPointerException {
    StringProperty stringproperty = getPropertyObject(s);
    if (stringproperty != null) {
      return getProperties(stringproperty);
    }
    jgl.Array array = new Array();
    Object obj = null;
    jgl.HashMap hashmap = findTable(s);
    if (hashmap != null) {
      obj = hashmap.get(s);
    }

    if (obj == null) {
      return array;
    }

    if (obj instanceof String) {
      array.add(obj);
    } else if (obj instanceof Array) {
      array = (Array) obj;
    }
    return array;
  }
예제 #12
0
  public static java.util.Vector getScriptList(
      java.lang.String s, com.dragonflow.HTTP.HTTPRequest httprequest) {
    java.util.Vector vector = new Vector();
    if (com.dragonflow.SiteView.Platform.isCommandLineRemote(s)) {
      com.dragonflow.Utils.RemoteFile remotefile = new RemoteFile(s, "scripts");
      int i = com.dragonflow.SiteView.Machine.getOS(s);
      jgl.Array array = remotefile.listFiles();
      for (int k = 0; k < array.size(); k++) {
        java.lang.String s2 = (java.lang.String) array.at(k);
        if (!s2.endsWith(".txt")
            && (!com.dragonflow.SiteView.Platform.isUnix(i) || !s2.startsWith("."))) {
          vector.addElement(s2);
          vector.addElement(s2);
        }
      }

    } else {
      java.io.File file =
          new File(
              com.dragonflow.SiteView.Platform.getUsedDirectoryPath(
                  "scripts", httprequest.getAccount()));
      java.lang.String as[] = file.list();
      for (int j = 0; j < as.length; j++) {
        java.lang.String s1 = as[j];
        if (s1.endsWith(".txt")
            || com.dragonflow.SiteView.Platform.isUnix() && s1.startsWith(".")) {
          continue;
        }
        java.io.File file1 = new File(file, as[j]);
        if (!file1.isDirectory()) {
          vector.addElement(s1);
          vector.addElement(s1);
        }
      }
    }
    return vector;
  }
예제 #13
0
  void flush(java.sql.PreparedStatement preparedstatement, jgl.Array array)
      throws java.sql.SQLException {
    if (debug) {
      COM.dragonflow.Log.LogManager.log("RunMonitor", "jdbc logger commit start");
    }
    int i = array.size();
    java.sql.SQLException sqlexception = null;
    while (array.size() > 0) {
      jgl.Array array1 = (jgl.Array) array.popFront();
      int j = array1.size();
      try {
        for (int k = 0; k < j; k++) {
          preparedstatement.setObject(k + 1, array1.at(k), 12);
        }

        preparedstatement.executeUpdate();
        continue;
      } catch (java.sql.SQLException sqlexception1) {
        sqlexception = sqlexception1;
        String s = "";
        for (int l = 0; l < j; l++) {
          if (l != 0) {
            s = s + ",";
          }
          s = s + array1.at(l);
        }

        COM.dragonflow.Log.LogManager.log(
            "Error", "jdbc logger error: exec, " + sqlexception1 + ", record=" + s);
        clearParameters(preparedstatement);
      }
    }
    connection.commit();
    if (debug) {
      COM.dragonflow.Log.LogManager.log(
          "RunMonitor", "jdbc logger commit complete, " + i + " records");
    }
    if (sqlexception != null) {
      throw sqlexception;
    } else {
      return;
    }
  }
예제 #14
0
  /**
   * @param date
   * @param propertiedobject
   * @param as
   */
  public synchronized void logLink(
      java.util.Date date,
      COM.dragonflow.Properties.PropertiedObject propertiedobject,
      String as[]) {
    jgl.Array array;
    java.sql.PreparedStatement preparedstatement;
    array = new Array();

    try {
      preparedstatement = getLinkStatement();
      if (preparedstatement == null) {
        return;
      }
      int i = 1;
      if (i <= linkVars) {
        array.add(COM.dragonflow.Log.JdbcLogger.jdbcDateFormat(date));
        i++;
      }
      if (i <= linkVars) {
        array.add(linkServer);
        i++;
      }
      if (i <= linkVars) {
        array.add(propertiedobject.getProperty(COM.dragonflow.SiteView.AtomicMonitor.pClass));
        i++;
      }
      if (i <= linkVars) {
        array.add(propertiedobject.getProperty(COM.dragonflow.SiteView.AtomicMonitor.pSample));
        i++;
      }
      if (i <= linkVars) {
        array.add(propertiedobject.getProperty(COM.dragonflow.SiteView.AtomicMonitor.pOwnerID));
        i++;
      }
      if (i <= linkVars) {
        array.add(getMonitorName(propertiedobject));
        i++;
      }
      if (i <= linkVars) {
        array.add(propertiedobject.getProperty(COM.dragonflow.SiteView.AtomicMonitor.pID));
        i++;
      }
      for (int j = 0; j < as.length; j++) {
        String s = as[j];
        if (s.length() > maxStringLength) {
          s = s.substring(0, maxStringLength);
        }
        if (i <= linkVars) {
          array.add(s);
          i++;
        }
      }

      for (; i <= linkVars; i++) {
        if (useNulls) {
          array.add(null);
        } else {
          array.add("");
        }
      }

      execute(preparedstatement, linkCache, array);
    } catch (java.lang.Exception exception) {
      COM.dragonflow.Log.LogManager.log(
          "RunMonitor",
          "jdbc link logger error: "
              + exception
              + ", "
              + propertiedobject.getProperty(COM.dragonflow.SiteView.AtomicMonitor.pGroupID)
              + "/"
              + propertiedobject.getProperty(COM.dragonflow.SiteView.AtomicMonitor.pID)
              + "/"
              + propertiedobject.getProperty(COM.dragonflow.SiteView.AtomicMonitor.pSample));
      COM.dragonflow.Log.LogManager.log(
          "Error",
          "jdbc link logger error: "
              + exception
              + ", "
              + propertiedobject.getProperty(COM.dragonflow.SiteView.AtomicMonitor.pGroupID)
              + "/"
              + propertiedobject.getProperty(COM.dragonflow.SiteView.AtomicMonitor.pID)
              + "/"
              + propertiedobject.getProperty(COM.dragonflow.SiteView.AtomicMonitor.pSample));
      reconnectTime = (long) (reconnectSeconds * 1000) + java.lang.System.currentTimeMillis();
      closeConnection();
    }
    return;
  }
예제 #15
0
  public jgl.Array exec(String s, com.dragonflow.SiteView.Machine machine, boolean flag) {
    super.exec(s, machine, flag);
    long l =
        com.dragonflow.Properties.StringProperty.toLong(
            machine.getProperty(com.dragonflow.SiteView.Machine.pTimeout));
    if (l == 0L) {
      l = 60000L;
    } else {
      l *= 1000L;
    }
    java.net.Socket socket = null;
    Object obj = null;
    java.io.PrintWriter printwriter = null;
    java.io.BufferedInputStream bufferedinputstream = null;
    String s1 = machine.getProperty(com.dragonflow.SiteView.Machine.pHost);
    int i = 513;
    int j = s1.indexOf(':');
    if (j != -1) {
      i = com.dragonflow.Utils.TextUtils.readInteger(s1, j + 1);
      s1 = s1.substring(0, j);
    }
    String s2 = machine.getProperty(com.dragonflow.SiteView.Machine.pLogin);
    String s3 = machine.getProperty(com.dragonflow.SiteView.Machine.pPassword);
    String s4 = machine.getProperty(com.dragonflow.SiteView.Machine.pLocalUser);
    String s5 = machine.getProperty(com.dragonflow.SiteView.Machine.pPasswordPrompt);
    String s6 = machine.getProperty(com.dragonflow.SiteView.Machine.pPrompt);
    String s7 = "";
    String s8 = "tty/9600";
    int k = com.dragonflow.StandardMonitor.URLMonitor.kURLok;
    byte abyte0[] = new byte[s2.length() + s4.length() + s8.length() + 4];
    int i1 = 0;
    abyte0[i1++] = 0;
    for (int j1 = 0; j1 < s4.length(); j1++) {
      abyte0[i1++] = (byte) s4.charAt(j1);
    }

    abyte0[i1++] = 0;
    for (int k1 = 0; k1 < s2.length(); k1++) {
      abyte0[i1++] = (byte) s2.charAt(k1);
    }

    abyte0[i1++] = 0;
    for (int l1 = 0; l1 < s8.length(); l1++) {
      abyte0[i1++] = (byte) s8.charAt(l1);
    }

    abyte0[i1++] = 0;
    traceMessage(s2 + "," + s4 + "," + s8, machine, TO_REMOTE);
    StringBuffer stringbuffer = new StringBuffer();
    progressMessage("Connecting to " + s1 + "...");
    try {
      socket = com.dragonflow.Utils.RloginCommandLine.getReservedPort(s1, i);
      progressMessage("Logging In...");
      java.io.OutputStream outputstream = socket.getOutputStream();
      outputstream.write(abyte0);
      outputstream.flush();
      printwriter = com.dragonflow.Utils.FileUtils.MakeOutputWriter(outputstream, "Cp1252");
      bufferedinputstream = new BufferedInputStream(socket.getInputStream());
      long l2 = com.dragonflow.SiteView.Platform.timeMillis() + l * 1000L;
      int j2 = 0;
      boolean flag1 = false;
      boolean flag2 = false;
      do {
        if (j2 == -1) {
          break;
        }
        j2 = readChar(bufferedinputstream, socket, l2);
        if (j2 == 65535) {
          for (int k2 = 0; k2 < 11; k2++) {
            j2 = readChar(bufferedinputstream, socket, l2);
          }

          byte abyte1[] = new byte[12];
          abyte1[0] = -1;
          abyte1[1] = -1;
          abyte1[2] = 115;
          abyte1[3] = 115;
          abyte1[4] = 0;
          abyte1[5] = 24;
          abyte1[6] = 0;
          abyte1[7] = 80;
          abyte1[8] = 4;
          abyte1[9] = 0;
          abyte1[10] = 4;
          abyte1[11] = 0;
          outputstream.write(abyte1);
          outputstream.flush();
          continue;
        }
        if (j2 == -1) {
          continue;
        }
        stringbuffer.append(j2);
        String s10 = toEncoding(stringbuffer.toString());
        if (detail && progressStream != null) {
          progressStream.print(j2);
        }
        if (s7.length() > 0 && s10.endsWith(s7)) {
          progressMessage("Login Failed");
          k = 401;
          break;
        }
        if (!flag2 && stringbuffer.length() < 15) {
          if (s10.endsWith(s5)) {
            traceMessage(
                "Password: "******"Sending Password...");
            printwriter.print(s3 + '\n');
            printwriter.flush();
            stringbuffer = new StringBuffer();
            s7 = machine.getProperty("_loginIncorrectPrompt");
            if (s7.length() == 0) {
              s7 = "ogin incorrect";
            }
          }
          continue;
        }
        if (!s10.endsWith(s6)) {
          continue;
        }
        if (flag1) {
          progressMessage("Command completed...");
          break;
        }
        progressMessage("Running command...");
        traceMessage(s, machine, TO_REMOTE);
        printwriter.print(s + '\n');
        printwriter.flush();
        stringbuffer = new StringBuffer();
        resetBuffer();
        flag1 = true;
        flag2 = true;
        s7 = "";
      } while (true);
    } catch (java.net.UnknownHostException unknownhostexception) {
      k = com.dragonflow.StandardMonitor.URLMonitor.kURLBadHostNameError;
    } catch (java.net.SocketException socketexception) {
      if (com.dragonflow.SiteView.Platform.noRoute(socketexception)) {
        k = com.dragonflow.StandardMonitor.URLMonitor.kURLNoRouteToHostError;
      } else {
        k = com.dragonflow.StandardMonitor.URLMonitor.kURLNoConnectionError;
      }
    } catch (java.io.InterruptedIOException interruptedioexception) {
      k = com.dragonflow.StandardMonitor.URLMonitor.kURLTimeoutError;
    } catch (Exception exception) {
      exception.printStackTrace();
      System.err.println(exception + " error: " + exception.getMessage());
      k = com.dragonflow.StandardMonitor.URLMonitor.kURLUnknownError;
    } finally {
      try {
        if (printwriter != null) {
          printwriter.close();
        }
        if (bufferedinputstream != null) {
          bufferedinputstream.close();
        }
        if (socket != null) {
          socket.close();
        }
      } catch (java.io.IOException ioexception) {
        System.err.println("Could not close FTP streams");
      }
    }
    jgl.Array array = null;
    if (k == com.dragonflow.StandardMonitor.URLMonitor.kURLok) {
      array = com.dragonflow.SiteView.Platform.split('\n', toEncoding(stringbuffer.toString()));
      if (!flag) {
        if (array.size() > 0) {
          array.popFront();
        }
        int i2 =
            com.dragonflow.SiteView.Machine.stringToOS(
                machine.getProperty(com.dragonflow.SiteView.Machine.pOS));
        if ((com.dragonflow.SiteView.Platform.isSGI(i2)
                || com.dragonflow.SiteView.Platform.isSolaris(i2))
            && array.size() > 0) {
          String s9 = (String) array.at(0);
          if (s9.trim().length() == 0) {
            array.popFront();
          }
        }
        if (array.size() > 0) {
          array.popBack();
        }
      }
      traceMessage(array, machine, FROM_REMOTE);
    } else {
      progressMessage("Connection failed: " + com.dragonflow.SiteView.Monitor.lookupStatus(k));
      array = new Array();
      traceMessage("ERROR - STATUS = " + k, machine, FROM_REMOTE);
      exitValue = k;
    }
    return array;
  }
예제 #16
0
  void printAddForm(String s) throws Exception {
    jgl.Array array = getFrames();
    if (request.isPost()) {
      if (dependentCheck()) {
        return;
      }
      String s1 = null;
      Object obj = null;
      jgl.HashMap hashmap1 = null;
      int i = -1;
      jgl.Array array1 = parseHosts(request.getValue("host"));
      boolean flag = array1.size() > 1;
      for (int j = 0; j < array1.size(); j++) {
        jgl.HashMap hashmap;
        if (s.equals("Add")) {
          if (hashmap1 == null) {
            hashmap1 = getMasterConfig();
          }
          s1 = getNextMachineID(hashmap1);
          hashmap = new HashMap();
          if (s1.length() == 0) {
            s1 = "10";
          }
          // hashmap1.put(getNextMachineName(),
          //        com.dragonflow.Utils.TextUtils.increment(s1));
          Config.configPut(getNextMachineName(), com.dragonflow.Utils.TextUtils.increment(s1));
        } else {
          s1 = getMachineID();
          hashmap = findMachine(array, s1);
          i = getIndex(array, hashmap);
          array.remove(hashmap);
        }
        hashmap.put("_host", array1.at(j).toString().trim());
        if (request.getValue("title").length() == 0) {
          hashmap.put("_name", hashmap.get("_host"));
        } else if (flag) {
          hashmap.put("_name", request.getValue("title") + " - " + hashmap.get("_host"));
        } else {
          hashmap.put("_name", request.getValue("title"));
        }
        saveAddProperties(s, hashmap, s1);
        if (s.equals("Add")) {
          array.add(hashmap);
        } else {
          array.insert(i, hashmap);
        }
      }

      saveMachines(array, getRemoteName());
      String s2 = "";
      if (request.getValue("addtest").indexOf("add") != -1 || array1.size() > 1) {
        s2 =
            getPageLink(getPage(), "List")
                + "&"
                + getIDName()
                + "="
                + s1
                + "&backURL="
                + request.getValue("backURL")
                + "&backLabel="
                + java.net.URLEncoder.encode(request.getValue("backLabel"))
                + "&backDescription="
                + java.net.URLEncoder.encode(request.getValue("backDescription"))
                + getReturnLink(false, request.getValue("storeID"));
      } else {
        s2 =
            getPageLink(getPage(), "Test")
                + "&"
                + getIDName()
                + "="
                + s1
                + "&backURL="
                + request.getValue("backURL")
                + "&backLabel="
                + java.net.URLEncoder.encode(request.getValue("backLabel"))
                + "&backDescription="
                + java.net.URLEncoder.encode(request.getValue("backDescription"))
                + getReturnLink(false, request.getValue("storeID"));
      }
      autoFollowPortalRefresh = false;
      printRefreshPage(s2, 0);
    } else {
      printForm(s, array, new HashMap());
    }
  }
예제 #17
0
  private void handleMetricData(java.lang.String s) throws java.lang.Exception {
    long l = java.lang.System.currentTimeMillis() / 1000L;
    org.w3c.dom.Document document = documentBuilder.parse(new InputSource(new StringReader(s)));
    org.w3c.dom.NodeList nodelist =
        document.getElementsByTagName((java.lang.String) xmlKeys.get("counter"));
    int i = nodelist.getLength();
    java.util.HashMap hashmap = new HashMap();
    for (int j = 0; j < i; j++) {
      org.w3c.dom.Element element = (org.w3c.dom.Element) nodelist.item(j);
      if (element.getAttribute((java.lang.String) xmlKeys.get("name")).equals("HPS")) {
        continue;
      }
      org.w3c.dom.Element element1 = (org.w3c.dom.Element) element.getParentNode();
      java.util.Map map = getValuesFromObject(element1);
      java.util.HashMap hashmap1 = new HashMap();
      jgl.Array array = new Array();
      for (org.w3c.dom.Element element2 = element1;
          element2.getTagName().equals((java.lang.String) xmlKeys.get("object"));
          element2 = (org.w3c.dom.Element) element2.getParentNode()) {
        java.lang.String s4 = element2.getAttribute((java.lang.String) xmlKeys.get("class"));
        java.lang.String s5 = (java.lang.String) xmlToLong.get(s4);
        if (s5 == null) {
          s5 = s4;
        }
        java.lang.String s6 = element2.getAttribute((java.lang.String) xmlKeys.get("name"));
        hashmap1.put(s5, s6);
        array.add(s5 + ": " + s6);
      }

      java.lang.String s2 = J2EEConnection.getNameFromArray(array);
      hashmap.put(s2, new SampleData(hashmap1, map));
    }

    for (java.util.Iterator iterator = activeMonitors.entrySet().iterator(); iterator.hasNext(); ) {
      java.util.Map.Entry entry = (java.util.Map.Entry) iterator.next();
      java.lang.String s1 = (java.lang.String) entry.getKey();
      Monitor monitor = (Monitor) entry.getValue();
      java.util.Set set = monitor.getCounters();
      java.util.LinkedList linkedlist = new LinkedList();
      java.lang.String s3 = java.lang.String.valueOf(l);
      boolean flag = false;
      for (java.util.Iterator iterator1 = set.iterator(); iterator1.hasNext(); ) {
        java.lang.String s7 = (java.lang.String) iterator1.next();
        SampleData sampledata = (SampleData) hashmap.get(s7);
        if (sampledata == null) {
          java.lang.System.out.println(
              "J2EEConnection " + getConnID() + "/" + s1 + ": Counter missing - " + s7);
          flag = true;
        } else {
          //                    com.dragonflow.topaz.j2ee.comm.HashedSample hashedsample = new
          // HashedSample(l, "J2EEMonitor");
          java.util.Map.Entry entry1;
          //                    for(java.util.Iterator iterator2 =
          // sampledata.values.entrySet().iterator(); iterator2.hasNext();
          // hashedsample.addValue((java.lang.String)entry1.getKey(), entry1.getValue()))
          //                    {
          //                        entry1 = (java.util.Map.Entry)iterator2.next();
          //                    }

          //                    hashedsample.addValue("TimeStamp", new Double(l));
          //                    hashedsample.setMeasurementValue("Monitor", "J2EEMonitor");
          //                    hashedsample.setMeasurementValue("TimeStamp", s3);
          //                    java.util.Map.Entry entry2;
          //                    for(java.util.Iterator iterator3 =
          // sampledata.measurment.entrySet().iterator(); iterator3.hasNext();
          // hashedsample.setMeasurementValue((java.lang.String)entry2.getKey(),
          // (java.lang.String)entry2.getValue()))
          //                    {
          //                        entry2 = (java.util.Map.Entry)iterator3.next();
          //                    }
          //
          //                    linkedlist.add(hashedsample);
        }
      }

      if (flag) {
        com.dragonflow.Log.LogManager.log("error", "Monitor: " + s1 + " missing counter");
        monitor.setLastError(
            "Probe is out of sync. This is probably due to a second client (such as SiteView or LoadRunner) running against the same probe. To resolve this, shut down the unwanted client and repost metrics from the Tools link on this row.");
      } else {
        monitor.setLastError(null);
      }
      //            com.dragonflow.topaz.j2ee.configuration.CheckSampleChunkResult
      // checksamplechunkresult = aggregationConfigurator.checkSampleChunk(linkedlist);
      //            java.util.ArrayList arraylist =
      // checksamplechunkresult.getResultListByAggregatorId("SiteViewAggregator");
      //            synchronized(monitor)
      //            {
      //                if(arraylist != null)
      //                {
      //                    monitor.getAggregator().addChunk(arraylist);
      //                    monitor.setHasResults(true);
      //                }
      //            }
    }
  }
예제 #18
0
  public void printBody() throws java.lang.Exception {
    if (!request.actionAllowed("_file")) {
      throw new HTTPRequestException(557);
    }
    java.lang.String s = request.getValue("operation");
    try {
      if (s.equals("run")) {
        java.lang.String s1 = request.getValue("command");
        java.lang.String s4 = request.getValue("machineID");
        jgl.HashMap hashmap = null;
        java.lang.String s6 = com.dragonflow.SiteView.Machine.getCommandString(s1, s4, hashmap);
        com.dragonflow.Utils.CommandLine commandline = new CommandLine();
        jgl.Array array2 = commandline.exec(s6, s4, com.dragonflow.SiteView.Platform.getLock(s4));
        outputStream.println("<PRE>");
        for (int k1 = 0; k1 < array2.size(); k1++) {
          outputStream.println(array2.at(k1));
        }

        outputStream.println("</PRE>");
      } else if (s.equals("scripts")) {
        java.lang.String s2 = request.getValue("machineID");
        outputStream.println("<PRE>");
        java.util.Vector vector1 = com.dragonflow.Page.remoteOpPage.getScriptList(s2, request);
        for (int k = 0; k < vector1.size(); k++) {
          outputStream.println(vector1.elementAt(k));
        }

        outputStream.println("</PRE>");
      } else if (s.equals("updateStaticPages")) {
        java.lang.String s3 =
            com.dragonflow.Utils.I18N.toDefaultEncoding(request.getValue("group"));
        if (s3.length() == 0) {
          com.dragonflow.SiteView.SiteViewGroup.updateStaticPages();
        } else {
          com.dragonflow.SiteView.SiteViewGroup.updateStaticPages(s3);
        }
      } else if (s.equals("getServers")) {
        java.util.Vector vector = com.dragonflow.SiteView.Platform.getServers();
        outputStream.println("<PRE>");
        for (int i = 0; i < vector.size(); i += 2) {
          outputStream.println(vector.elementAt(i));
        }

        outputStream.println("</PRE>");
      } else if (s.equals("monitorClasses")) {
        outputStream.println("<PRE>");
        jgl.Array array = com.dragonflow.Page.monitorPage.getMonitorClasses();
        for (int j = 0; j < array.size(); j++) {
          java.lang.String s5 = ((java.lang.Class) array.at(j)).getName();
          int i1 = s5.lastIndexOf(".");
          if (i1 >= 0) {
            s5 = s5.substring(i1 + 1);
          }
          outputStream.println(s5);
        }

        outputStream.println("</PRE>");
      } else if (s.equals("actionClasses")) {
        com.dragonflow.Page.alertPage alertpage = new alertPage();
        outputStream.println("<PRE>");
        jgl.Array array1 = alertpage.getActionClasses();
        for (int l = 0; l < array1.size(); l++) {
          java.lang.String s7 = ((java.lang.Class) array1.at(l)).getName();
          int j1 = s7.lastIndexOf(".");
          if (j1 >= 0) {
            s7 = s7.substring(j1 + 1);
          }
          outputStream.println(s7);
        }

        outputStream.println("</PRE>");
      } else if (s.equals("platform")) {
        outputStream.println("<PRE>");
        outputStream.println("os.name=" + java.lang.System.getProperty("os.name"));
        outputStream.println("os.version=" + java.lang.System.getProperty("os.version"));
        outputStream.println("version=" + com.dragonflow.SiteView.Platform.getVersion());
        outputStream.println("</PRE>");
      } else {
        throw new Exception("unknown operation, " + s);
      }
    } catch (java.lang.Exception exception) {
      outputStream.println("error: " + exception + ", " + s);
    }
  }
예제 #19
0
  /**
   * @param date
   * @param propertiedobject
   * @param s
   * @param as
   * @param i
   */
  public synchronized void logFields(
      java.util.Date date,
      COM.dragonflow.Properties.PropertiedObject propertiedobject,
      String s,
      String as[],
      int i) {
    jgl.Array array = new Array();
    try {
      java.sql.PreparedStatement preparedstatement = getStatement();
      if (preparedstatement == null) {
        return;
      }
      int j = 1;
      if (j <= vars) {
        array.add(COM.dragonflow.Log.JdbcLogger.jdbcDateFormat(date));
        j++;
      }
      if (server != null && j <= vars) {
        array.add(server);
        j++;
      }
      if (j <= vars) {
        array.add(propertiedobject.getProperty(COM.dragonflow.SiteView.AtomicMonitor.pClass));
        j++;
      }
      if (j <= vars) {
        array.add(s);
        j++;
      }
      for (int k = 0; k < i && j <= vars; k++) {
        String s1 = as[k];
        if (s1.length() > maxStringLength) {
          s1 = s1.substring(0, maxStringLength);
        }
        array.add(s1);
        j++;
      }

      for (; j <= vars; j++) {
        if (useNulls) {
          array.add(null);
        } else {
          array.add("");
        }
      }

      execute(preparedstatement, logCache, array);
    } catch (java.lang.Exception exception) {
      COM.dragonflow.Log.LogManager.log(
          "RunMonitor",
          "jdbc logger error: "
              + exception
              + ", "
              + propertiedobject.getProperty(COM.dragonflow.SiteView.AtomicMonitor.pGroupID)
              + "/"
              + propertiedobject.getProperty(COM.dragonflow.SiteView.AtomicMonitor.pID)
              + "/"
              + propertiedobject.getProperty(COM.dragonflow.SiteView.AtomicMonitor.pSample));
      COM.dragonflow.Log.LogManager.log(
          "Error",
          "jdbc logger error: "
              + exception
              + ", "
              + propertiedobject.getProperty(COM.dragonflow.SiteView.AtomicMonitor.pGroupID)
              + "/"
              + propertiedobject.getProperty(COM.dragonflow.SiteView.AtomicMonitor.pID)
              + "/"
              + propertiedobject.getProperty(COM.dragonflow.SiteView.AtomicMonitor.pSample));
      reconnectTime = (long) (reconnectSeconds * 1000) + java.lang.System.currentTimeMillis();
      closeConnection();
    }
    return;
  }
예제 #20
0
  void printListForm(String s) throws Exception {
    String s1 = request.getValue("backURL");
    String s3 = request.getValue("storeURL");
    String s4 = request.getValue("storeID");
    if (s1.length() > 0) {
      com.dragonflow.Page.serverPage.clientID++;
      com.dragonflow.Page.serverPage.setReturnURL(
          com.dragonflow.Page.serverPage.storeReturnURL, s3);
      com.dragonflow.Page.serverPage.setReturnURL(com.dragonflow.Page.serverPage.thisURL, s1);
      s4 = String.valueOf(com.dragonflow.Page.serverPage.clientID);
    }
    String s5 = getListTitle();
    String s6 = getListSubtitle();
    printBodyHeader(s5);
    printButtonBar(getHelpPage(), "", getSecondNavItems(request));
    if (s4.length() == 0) {
      printPrefsBar(getPrefTitle());
    }
    jgl.Array array = getListTableHeaders(s4);
    outputStream.println(
        "<H2>"
            + s5
            + "</H2> "
            + "<p>"
            + s6
            + "</p>"
            + "<TABLE WIDTH=100% BORDER=2 cellspacing=0><TR CLASS=\"tabhead\">");
    for (int i = 0; i < array.size(); i++) {
      outputStream.println("<TH align=left>" + array.at(i) + "</TH>");
    }

    outputStream.println("</TR>");
    jgl.Array array1 = readMachines(getRemoteName());
    if (array1.size() == 0) {
      outputStream.println(
          "<TR><TD> </TD><TD align=center>no remote servers defined</TD><TD> </TD></TR>\n");
    } else {
      for (java.util.Enumeration enumeration = array1.elements();
          enumeration.hasMoreElements();
          outputStream.println("</TR>")) {
        jgl.HashMap hashmap = (jgl.HashMap) enumeration.nextElement();
        jgl.Array array2 = getListTableRow(hashmap, s4);
        outputStream.println("<TR>");
        for (int j = 0; j < array2.size(); j++) {
          outputStream.println("<TD align=left>" + array2.at(j) + "</TD>");
        }
      }
    }
    outputStream.println("</TABLE><BR>");
    if (request.actionAllowed("_preference") || s4.length() > 0) {
      outputStream.println(
          "<A HREF="
              + getPageLink(getPage(), "Add")
              + getReturnLink(false, s4)
              + ">Add</A> a Remote Machine\n"
              + "<br><br>\n");
    }
    if (s4.length() > 0) {
      String s2 =
          new String(
              com.dragonflow.Page.serverPage.getReturnURL(
                  com.dragonflow.Page.serverPage.thisURL, s4));
      outputStream.println(
          "<a href=\"" + s2 + "&pop=true&storeID=" + s4 + "\">Return to Choose Server</a>");
    }
    printFooter(outputStream);
  }
예제 #21
0
  public synchronized void log(
      String s, java.util.Date date, COM.dragonflow.Properties.PropertiedObject propertiedobject) {
    if (method.equals("customOnly")) {
      return;
    }

    try {
      Enumeration enumeration;
      jgl.Array array1;
      jgl.Array array = propertiedobject.getLogProperties();
      enumeration = array.elements();
      if (method.equals("oneRowPerProperty")) {
        array1 = new Array();
        int i = 0;
        for (byte byte0 = 5; enumeration.hasMoreElements() && i < byte0; i++) {
          COM.dragonflow.Properties.StringProperty stringproperty =
              (COM.dragonflow.Properties.StringProperty) enumeration.nextElement();
          array1.add(stringproperty);
        }

        jgl.Array array2;
        java.sql.PreparedStatement preparedstatement1;
        while (enumeration.hasMoreElements()) {
          array2 = new Array();
          preparedstatement1 = getStatement();
          if (preparedstatement1 == null) {
            return;
          }
          COM.dragonflow.Properties.StringProperty stringproperty2 =
              (COM.dragonflow.Properties.StringProperty) enumeration.nextElement();
          if (allowProperty(propertiedobject, stringproperty2)) {
            int k = 1;
            if (k <= vars) {
              array2.add(COM.dragonflow.Log.JdbcLogger.jdbcDateFormat(date));
              k++;
            }
            if (server != null && k <= vars) {
              array2.add(server);
              k++;
            }
            if (k <= vars) {
              array2.add(
                  propertiedobject.getProperty(COM.dragonflow.SiteView.AtomicMonitor.pClass));
              k++;
            }
            if (k <= vars) {
              array2.add(
                  propertiedobject.getProperty(COM.dragonflow.SiteView.AtomicMonitor.pSample));
              k++;
            }
            Enumeration enumeration1 = array1.elements();
            while (enumeration1.hasMoreElements()) {
              COM.dragonflow.Properties.StringProperty stringproperty3 =
                  (COM.dragonflow.Properties.StringProperty) enumeration1.nextElement();
              if (k <= vars) {
                String s3 = propertiedobject.getProperty(stringproperty3);
                if (stringproperty3 == COM.dragonflow.SiteView.AtomicMonitor.pName) {
                  s3 = getMonitorName(propertiedobject);
                }
                if (s3.length() > maxStringLength) {
                  s3 = s3.substring(0, maxStringLength);
                }
                array2.add(s3);
                k++;
              }
            }

            if (k <= vars) {
              array2.add(propertiedobject.getPropertyName(stringproperty2));
              k++;
            }
            if (k <= vars) {
              String s2 = propertiedobject.getProperty(stringproperty2);
              if (s2.length() > maxStringLength) {
                s2 = s2.substring(0, maxStringLength);
              }
              array2.add(s2);
              k++;
            }
            for (; k <= vars; k++) {
              if (useNulls) {
                array2.add(null);
              } else {
                array2.add("");
              }
            }

            execute(preparedstatement1, logCache, array2);
          }
        }
      }

      java.sql.PreparedStatement preparedstatement;
      array1 = new Array();
      preparedstatement = getStatement();
      if (preparedstatement == null) {
        return;
      }

      int j = 1;
      if (j <= vars) {
        array1.add(COM.dragonflow.Log.JdbcLogger.jdbcDateFormat(date));
        j++;
      }
      if (server != null && j <= vars) {
        array1.add(server);
        j++;
      }
      if (j <= vars) {
        array1.add(propertiedobject.getProperty(COM.dragonflow.SiteView.AtomicMonitor.pClass));
        j++;
      }
      if (j <= vars) {
        array1.add(propertiedobject.getProperty(COM.dragonflow.SiteView.AtomicMonitor.pSample));
        j++;
      }
      while (enumeration.hasMoreElements() && j <= vars) {
        COM.dragonflow.Properties.StringProperty stringproperty1 =
            (COM.dragonflow.Properties.StringProperty) enumeration.nextElement();
        if (allowProperty(propertiedobject, stringproperty1)) {
          String s1 = propertiedobject.getProperty(stringproperty1);
          if (stringproperty1 == COM.dragonflow.SiteView.AtomicMonitor.pName) {
            s1 = getMonitorName(propertiedobject);
          }
          if (s1.length() > maxStringLength) {
            s1 = s1.substring(0, maxStringLength);
          }
          array1.add(s1);
          j++;
        }
      }

      for (; j <= vars; j++) {
        if (useNulls) {
          array1.add(null);
        } else {
          array1.add("");
        }
      }

      execute(preparedstatement, logCache, array1);
    } catch (java.lang.Exception exception) {
      COM.dragonflow.Log.LogManager.log(
          "RunMonitor",
          "jdbc logger error: "
              + exception
              + ", "
              + propertiedobject.getProperty(COM.dragonflow.SiteView.AtomicMonitor.pGroupID)
              + "/"
              + propertiedobject.getProperty(COM.dragonflow.SiteView.AtomicMonitor.pID)
              + "/"
              + propertiedobject.getProperty(COM.dragonflow.SiteView.AtomicMonitor.pSample));
      COM.dragonflow.Log.LogManager.log(
          "Error",
          "jdbc logger error: "
              + exception
              + ", "
              + propertiedobject.getProperty(COM.dragonflow.SiteView.AtomicMonitor.pGroupID)
              + "/"
              + propertiedobject.getProperty(COM.dragonflow.SiteView.AtomicMonitor.pID)
              + "/"
              + propertiedobject.getProperty(COM.dragonflow.SiteView.AtomicMonitor.pSample));
      reconnectTime = (long) (reconnectSeconds * 1000) + java.lang.System.currentTimeMillis();
      closeConnection();
    }
  }