예제 #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");
   }
 }