예제 #1
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);
   }
 }
예제 #2
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;
  }
예제 #3
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.");
  }
예제 #4
0
 String getNextMachineID(jgl.HashMap hashmap) {
   String s = null;
   if (hashmap != null) {
     s = com.dragonflow.Utils.TextUtils.getValue(hashmap, getNextMachineName());
   } else {
     s = request.getValue(getNextMachineName());
   }
   return s;
 }
예제 #5
0
 protected String getDisableCacheHtml(jgl.HashMap hashmap) {
   String s =
       com.dragonflow.Utils.TextUtils.getValue(
           hashmap, com.dragonflow.SiteView.Machine.pSSHConnectionCaching.getName());
   if (s.length() > 0) {
     s = " CHECKED";
   }
   return field(
       "Disable Connection Caching",
       "<input type=checkbox name=disableCache" + s + ">",
       "Check this box to disable caching of SSH connections. ");
 }
예제 #6
0
 protected String getSSHForceVersion2Html(jgl.HashMap hashmap) {
   String s =
       com.dragonflow.Utils.TextUtils.getValue(
           hashmap, com.dragonflow.SiteView.Machine.pSSHForceVersion2.getName());
   if (s.length() > 0) {
     s = " CHECKED";
   }
   return field(
       "SSH Version 2 Only",
       "<input type=checkbox name=version2" + s + ">",
       "Check this box to force SSH to only use SSH protocol version 2. <b> ( This SSH option is only supported using the internal java libraries connection method) </b>");
 }
예제 #7
0
 protected String getPortNumberHtml(jgl.HashMap hashmap) {
   String s =
       com.dragonflow.Utils.TextUtils.getValue(
           hashmap, com.dragonflow.SiteView.Machine.pSSHPort.getName());
   if (s.length() == 0) {
     s = com.dragonflow.SiteView.Machine.pSSHPort.getDefault();
   }
   return field(
       "Port Number",
       "<input type=text name=sshPort size=2 value=\"" + s + "\">",
       "Enter the port number that the ssh server is running on. <b> Default is 22. </b>");
 }
예제 #8
0
 protected String getNumConnectionseHtml(jgl.HashMap hashmap) {
   String s =
       com.dragonflow.Utils.TextUtils.getValue(
           hashmap, com.dragonflow.SiteView.Machine.pSSHConnectionsLimit.getName());
   if (s.length() == 0) {
     s = com.dragonflow.SiteView.Machine.pSSHConnectionsLimit.getDefault();
   }
   return field(
       "Connection Limit",
       "<input type=text name=sshConnectionsLimit size=2 value=\"" + s + "\">",
       "Enter the maximum number of open connections allowed for this remote.");
 }
예제 #9
0
 protected String getSSHCommandLine(jgl.HashMap hashmap) {
   String s =
       com.dragonflow.Utils.TextUtils.getValue(
           hashmap, com.dragonflow.SiteView.Machine.pSSHCommandLine.getName());
   if (s.length() == 0) {
     s = com.dragonflow.SiteView.Machine.pSSHCommandLine.getDefault();
   }
   return field(
       "Custom Commandline",
       "<input type=text name=sshCommandLine size=50 value=\"" + s + "\">",
       "Enter the command for execution of external ssh client.  For substituion with above options use $host$, $user$ and $password$ respectivly. <b> This setting is for only for connections using an external process.</b>");
 }
예제 #10
0
 protected String getSSHKeyFileHtml(jgl.HashMap hashmap) {
   String s =
       com.dragonflow.Utils.TextUtils.getValue(
           hashmap, com.dragonflow.SiteView.Machine.pSshKeyFile.getName());
   if (s.length() == 0) {
     s = com.dragonflow.SiteView.Machine.pSshKeyFile.getDefault();
   }
   return field(
       "Key File for SSH connections",
       "<input type=text name=keyFile size=50 value=\"" + s + "\">",
       "Enter the path to the file containing the private key for this SSH connection. <b> Only valid if authentication method is \"Key File\".");
 }
예제 #11
0
 protected String getSshAuthMethodHtml(jgl.HashMap hashmap) {
   String s =
       com.dragonflow.Utils.TextUtils.getValue(
           hashmap, com.dragonflow.SiteView.Machine.pSshAuthMethod.getName());
   if (s.length() == 0) {
     s = PASSWORD_FORM_VARIABLE;
   }
   return field(
       "SSH Authentication Method",
       "<select name=sshAuthMethod size=1>"
           + com.dragonflow.Page.remoteBase.getOptionsHTML(
               com.dragonflow.SiteView.Machine.getAllowedSshAuthMethods(), s),
       "Select the method to use to authenticate to the remote server.");
 }
예제 #12
0
 void formLogin(jgl.HashMap hashmap) {
   String s = getPage();
   String s1 = "";
   if (s.indexOf("ntmachine") != -1) {
     s1 =
         "Enter the login for the remote server. <br>For a domain login, include the domain name before the user login (example: <i>domainname\\user</i>). <br>For a local or standalone login, include the machine name before the user login  (example: <i>machinename\\user</i>).";
   } else if (s.indexOf("machine") != -1) {
     s1 = "Enter the login to use for connecting to the remote server";
   } else {
     s1 = "Enter the login for the remote server";
   }
   outputStream.println(
       field(
           "Login",
           "<input type=text name=login size=50 value=\""
               + com.dragonflow.Utils.TextUtils.getValue(hashmap, "_login")
               + "\">",
           s1));
   String s2 = "";
   if (com.dragonflow.Utils.TextUtils.getValue(
           hashmap, com.dragonflow.SiteView.Machine.pPassword.getName())
       != "") {
     s2 = DEFAULT_PASSWORD;
   }
   outputStream.println(
       field(
           "Password",
           "<input type=password name=password size=50 value=\"" + s2 + "\">",
           "The password for the remote server or the passphrase for the SSH key file."));
   outputStream.println(
       field(
           "Title",
           "<input type=text name=title size=50 value=\""
               + com.dragonflow.Page.remoteBase.getValue(hashmap, "_name")
               + "\">",
           "Optional title describing the remote server. The default title is the server address"));
 }
예제 #13
0
 void printForm() {
   jgl.HashMap hashmap = getMasterConfig();
   StringBuffer stringbuffer = new StringBuffer();
   StringBuffer stringbuffer1 = new StringBuffer();
   com.dragonflow.Properties.StringProperty.getPrivate(
       com.dragonflow.Page.jdbcConfigPrefsPage.getValue(hashmap, "_configJdbcPassword"),
       "configJdbcPassword",
       "jdbcSuff",
       stringbuffer,
       stringbuffer1);
   printBodyHeader("Database Driven Configuration");
   printButtonBar("DBDrivenConfigs.htm", "", getSecondNavItems(request));
   printPrefsBar("DDC");
   String s = "";
   if (com.dragonflow.Utils.TextUtils.getValue(hashmap, "_configJdbcURL").length() == 0) {
     s = "CHECKED";
   }
   outputStream.print(
       getPagePOST("jdbcConfigPrefs", "save")
           + "<HR><CENTER><H2>Database Driven Configuration</H2></CENTER><BR>\n"
           + "SiteView can optionally read monitor settings and configurations "
           + " from a database, and save configurations"
           + " to a database. Any database which supports the ODBC or JDBC standards can be used, including Microsoft SQL Server and Oracle.\n"
           + "<p>For additional information on this feature go to our Customer Support <a href=\"http://support.dragonflow.com/\">Knowledge Base</a> and   "
           + " search for Storing monitor configurations in a database. "
           + "<p><b>(note:</b> changes to Configuration Database preferences do not take effect until the next time SiteView is restarted)\n"
           + "<hr><TABLE border=0 width=100% cellspacing=0 cellpadding=5>"
           + "<TR><TD ALIGN=LEFT VALIGN=TOP WIDTH=20%>Database Connection URL:</TD>"
           + "<TD VALIGN=TOP><input type=text name=configJdbcURL size=40 value=\""
           + com.dragonflow.Page.jdbcConfigPrefsPage.getValue(hashmap, "_configJdbcURL")
           + "\">\n"
           + "</TD><TD VALIGN=TOP>"
           + "Enter the URL to the database connection</TD></TR>"
           + "<tr><td>&nbsp;</td><td spancol=2>If you're using an ODBC connection: use - <b><i>jdbc:odbc:myDSNName</i></b><br>"
           + "If you're using a SQL connection: use - <b><i>jdbc:inetdae:myserver.mycompany.com:1433?database=master</i></b></TD></TR>"
           + "<tr><td colspan=3><hr></td></tr>"
           + "<TR><TD ALIGN=LEFT VALIGN=TOP WIDTH=20%>Database Driver:</TD>"
           + "<TD VALIGN=TOP><input type=text name=configJdbcDriver size=40 value=\""
           + com.dragonflow.Page.jdbcConfigPrefsPage.getValue(hashmap, "_configJdbcDriver")
           + "\">\n"
           + "</TD><TD VALIGN=TOP>"
           + "Driver used to connect to the database</TD></TR>"
           + "<tr><td>&nbsp;</td><td spancol=2>If you're using an ODBC connection: use - <b><i>sun.jdbc.odbc.JdbcOdbcDriver</i></b><br>"
           + "If you're using a SQL connection: use - <b><i>com.inet.tds.TdsDriver</i></b><br>"
           + "For all other DBs, go to their web site and install their JDBC thin driver.</TD></TR>"
           + "<tr><td colspan=3><hr></td></tr>"
           + "<TR><TD ALIGN=LEFT VALIGN=TOP WIDTH=20%>Database Username:</TD>"
           + "<TD VALIGN=TOP><input type=text name=configJdbcUser size=40 value=\""
           + com.dragonflow.Page.jdbcConfigPrefsPage.getValue(hashmap, "_configJdbcUser")
           + "\">\n"
           + "</TD><TD VALIGN=TOP>"
           + "Enter the username used to connect to the database.</TD></TR>"
           + "<tr><td colspan=3><hr></td></tr>"
           + "<TR><TD ALIGN=LEFT VALIGN=TOP WIDTH=20%>Database Password:</TD>"
           + "<TD VALIGN=TOP>"
           + stringbuffer.toString()
           + " size=40>\n"
           + stringbuffer1.toString()
           + "</TD><TD VALIGN=TOP>"
           + "Enter the password used to connect to the database.</TD></TR>"
           + "<tr><td colspan=3><hr></td></tr>"
           + "</table>\n"
           + "<p><table><tr><td><input type=submit name=submit value=\"Save Changes\"></td>\n");
   if (com.dragonflow.Page.jdbcConfigPrefsPage.getValue(hashmap, "_configJdbcURL").length() > 0
       && com.dragonflow.Page.jdbcConfigPrefsPage.getValue(hashmap, "_configJdbcDriver").length()
           > 0) {
     outputStream.print(
         "<td><input type=submit name=submit value=\"Remove DataBase Connection\"></td>");
     outputStream.print(
         "<td><input type=submit name=submit value=\"Sync SiteView From DB\"></td>");
     if (com.dragonflow.Page.jdbcConfigPrefsPage
             .getValue(hashmap, "_configJdbcSyncDBFromFiles")
             .length()
         > 0) {
       outputStream.print(
           "<td><input type=submit name=submit value=\"Sync DB From SiteView\"></td>");
     }
   }
   outputStream.print("</tr></table>");
   String s1 = com.dragonflow.Utils.TextUtils.getValue(hashmap, "_jdbcConfigdisabled");
   String s2 = "";
   if (s1.length() > 0) {
     s2 = "CHECKED";
   }
   outputStream.print(
       "<p><HR><CENTER><H3>Advanced Options</H3></CENTER><DL><P><DT><input type=checkbox name=jdbcConfigdisabled "
           + s2
           + ">Disable syncing configuration files from database.<P>\n"
           + "<P><DT><input type=checkbox name=initializeDatabaseFromFiles "
           + s
           + ">Initialize database from current configuration files<P>\n"
           + "<DD>If you would like the database initialized with the current contents of the configuration files, check this box.\n"
           + "<B>Warning: checking this box will delete the current configurations stored in the database for this server - we advise using this feature\n"
           + "only when initially setting up database configuration.</B>"
           + "</DL>"
           + "<P><DT>Configuration Update Frequency: <input type=text name=configJdbcCheckFrequency size=40 value=\""
           + com.dragonflow.Page.jdbcConfigPrefsPage.getValue(hashmap, "_configJdbcCheckFrequency")
           + "\"><P>\n"
           + "<DD>Enter the configuration update frequnce (seconds).\n"
           + "</FORM>\n"
           + "<br>\n"
           + "<CENTER><B>Version "
           + com.dragonflow.SiteView.Platform.getVersion()
           + "</B><p>\n");
   printFooter(outputStream);
 }