示例#1
0
 public void printBody() throws Exception {
   if (!request.actionAllowed("_preference")) {
     throw new HTTPRequestException(557);
   }
   String s = request.getValue("operation");
   if (request.isPost()) {
     if (s.equals("save") || s.equals("setup")) {
       savePreferences();
       if (request.getValue("submit").startsWith("Save")) {
         if (com.dragonflow.Properties.JdbcConfig.getJdbcConfig()
             .testDBConnection(
                 request.getValue("configJdbcURL"),
                 request.getValue("configJdbcDriver"),
                 request.getValue("configJdbcUser"),
                 com.dragonflow.Properties.StringProperty.getPrivate(
                     request, "configJdbcPassword", "jdbcSuff", null, null))) {
           com.dragonflow.SiteView.SiteViewGroup.currentSiteView().StartDDC();
         } else {
           com.dragonflow.Page.jdbcConfigPrefsPage.removeDBConnection(request);
           com.dragonflow.SiteView.SiteViewGroup.currentSiteView().StopDDC();
         }
       } else if (request.getValue("submit").startsWith("Remove")) {
         com.dragonflow.Page.jdbcConfigPrefsPage.removeDBConnection(request);
         com.dragonflow.SiteView.SiteViewGroup.currentSiteView().StopDDC();
       } else if (request.getValue("submit").startsWith("Sync SiteView")) {
         com.dragonflow.Properties.JdbcConfig.getJdbcConfig().execute();
       } else {
         com.dragonflow.Properties.JdbcConfig.syncDBFromSS();
       }
       printRefreshPage("/SiteView/" + request.getAccountDirectory() + "/SiteView.html", 0);
     }
   } else {
     printForm();
   }
 }
示例#2
0
 void savePreferences() {
   try {
     // jgl.HashMap hashmap = getMasterConfig();
     /*            hashmap.put("_configJdbcPassword", com.dragonflow.Properties.StringProperty.getPrivate(request, "configJdbcPassword", "jdbcSuff", null, null));
                 hashmap.put("_configJdbcURL", request.getValue("configJdbcURL"));
                 hashmap.put("_configJdbcUser", request.getValue("configJdbcUser"));
                 hashmap.put("_configJdbcDriver", request.getValue("configJdbcDriver"));
                 hashmap.put("_configJdbcCheckFrequency", request.getValue("configJdbcCheckFrequency"));
                 hashmap.put("_jdbcConfigdisabled", request.getValue("jdbcConfigdisabled"));
     */
     Config.configPut(
         "_configJdbcPassword",
         com.dragonflow.Properties.StringProperty.getPrivate(
             request, "configJdbcPassword", "jdbcSuff", null, null));
     Config.configPut("_configJdbcURL", request.getValue("configJdbcURL"));
     Config.configPut("_configJdbcUser", request.getValue("configJdbcUser"));
     Config.configPut("_configJdbcDriver", request.getValue("configJdbcDriver"));
     Config.configPut("_configJdbcCheckFrequency", request.getValue("configJdbcCheckFrequency"));
     Config.configPut("_jdbcConfigdisabled", request.getValue("jdbcConfigdisabled"));
     com.dragonflow.SiteView.SiteViewGroup siteviewgroup =
         com.dragonflow.SiteView.SiteViewGroup.currentSiteView();
     // saveMasterConfig(hashmap);
     if (request.getValue("initializeDatabaseFromFiles").length() > 0) {
       initializeDatabase();
     }
     int i = siteviewgroup.getSettingAsLong("_fileCheckFrequency", 120) * 1000;
     if (siteviewgroup.maintenanceScheduler != null) {
       siteviewgroup.maintenanceScheduler.scheduleRepeatedPeriodicAction(
           siteviewgroup.checkConfiguration, i);
     }
     printPreferencesSaved();
   } catch (Exception ioexception) {
     printError(
         "The preferences could not be saved", "master.config file could not be saved", "10");
   }
 }
示例#3
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);
    }
  }