Package org.apache.openmeetings.installation

Examples of org.apache.openmeetings.installation.ImportInitvalues


          }
          if (cmdl.hasOption("file")) {
            File backup = checkRestoreFile(file);
            dropDB(connectionProperties);
           
            ImportInitvalues importInit = getApplicationContext(ctxName).getBean(ImportInitvalues.class);
            importInit.loadSystem(cfg, force);
            restoreOm(ctxName, backup);
          } else {
            AdminUserDetails admin = checkAdminDetails(ctxName);
            dropDB(connectionProperties);
           
            ImportInitvalues importInit = getApplicationContext(ctxName).getBean(ImportInitvalues.class);
            importInit.loadAll(cfg, admin.login, admin.pass, admin.email, admin.group, admin.tz, force);
          }         
         
          InstallationDocumentHandler.createDocument(3);
        } catch(Exception e) {
          handleError("Install failed", e);
        }
        break;
      case backup:
        try {
          File f;
          if (!cmdl.hasOption("file")) {
            file = "backup_" + CalendarPatterns.getTimeForStreamId(new Date()) + ".zip";
            f = new File(home, file);
            System.out.println("File name was not specified, '" + file + "' will be used");
          } else {
            f = new File(file);
          }
          boolean includeFiles = Boolean.parseBoolean(cmdl.getOptionValue("exclude-files", "true"));
          File backup_dir = new File(OmFileHelper.getUploadTempDir(), "" + System.currentTimeMillis());
          backup_dir.mkdirs();
         
          BackupExport export = getApplicationContext(ctxName).getBean(BackupExport.class);
          export.performExport(f, backup_dir, includeFiles);
          FileHelper.removeRec(backup_dir);
          backup_dir.delete();
        } catch (Exception e) {
          handleError("Backup failed", e);
        }
        break;
      case restore:
        try {
          restoreOm(ctxName, checkRestoreFile(file));
        } catch (Exception e) {
          handleError("Restore failed", e);
        }
        break;
      case languages:
        System.out.println("All language files will be reimported");
        try {
          ImportInitvalues importInit = getApplicationContext(ctxName).getBean(ImportInitvalues.class);
          if (cmdl.hasOption("lang")) {
            String lang = cmdl.getOptionValue("lang");
            System.out.println("Only '" + lang + "' language will be reimported");
            try {
              int id = Integer.parseInt(lang);
              importInit.loadLanguagesFile(id);
            } catch (NumberFormatException e) {
              importInit.loadLanguagesFile(lang);
            }
          } else {
            System.out.println("All language files will be reimported");
            importInit.loadLanguagesFiles();
          }
        } catch (Exception e) {
          handleError("Language reimport failed", e);
        }
        break;
View Full Code Here


      if (checkPassword(admin.pass)) {
        System.out.println("Password was not provided, or too short, should be at least " + InstallationConfig.USER_PASSWORD_MINIMUM_LENGTH + " character long.");
        System.exit(1);
      }
    }
    ImportInitvalues importInit = getApplicationContext(ctxName).getBean(ImportInitvalues.class);
    Map<String, String> tzMap = ImportHelper.getAllTimeZones(importInit.getTimeZones());
    admin.tz = null;
    if (cmdl.hasOption("tz")) {
      admin.tz = cmdl.getOptionValue("tz");
      admin.tz = tzMap.containsKey(admin.tz) ? admin.tz : null;
    }
View Full Code Here

          }
          if (cmdl.hasOption("file")) {
            File backup = checkRestoreFile(file);
            dropDB(connectionProperties);
           
            ImportInitvalues importInit = getApplicationContext(ctxName).getBean(ImportInitvalues.class);
            importInit.loadSystem(cfg, force);
            restoreOm(ctxName, backup);
          } else {
            checkAdminDetails(ctxName);
            dropDB(connectionProperties);
           
            ImportInitvalues importInit = getApplicationContext(ctxName).getBean(ImportInitvalues.class);
            importInit.loadAll(cfg, force);
          }         
         
          InstallationDocumentHandler.createDocument(3);
        } catch(Exception e) {
          handleError("Install failed", e);
        }
        break;
      case backup:
        try {
          File f;
          if (!cmdl.hasOption("file")) {
            file = "backup_" + CalendarPatterns.getTimeForStreamId(new Date()) + ".zip";
            f = new File(home, file);
            System.out.println("File name was not specified, '" + file + "' will be used");
          } else {
            f = new File(file);
          }
          boolean includeFiles = Boolean.parseBoolean(cmdl.getOptionValue("exclude-files", "true"));
          File backup_dir = new File(OmFileHelper.getUploadTempDir(), "" + System.currentTimeMillis());
          backup_dir.mkdirs();
         
          BackupExport export = getApplicationContext(ctxName).getBean(BackupExport.class);
          export.performExport(f, backup_dir, includeFiles);
          FileHelper.removeRec(backup_dir);
          backup_dir.delete();
        } catch (Exception e) {
          handleError("Backup failed", e);
        }
        break;
      case restore:
        try {
          restoreOm(ctxName, checkRestoreFile(file));
        } catch (Exception e) {
          handleError("Restore failed", e);
        }
        break;
      case languages:
        System.out.println("All language files will be reimported");
        try {
          ImportInitvalues importInit = getApplicationContext(ctxName).getBean(ImportInitvalues.class);
          if (cmdl.hasOption("lang")) {
            String lang = cmdl.getOptionValue("lang");
            System.out.println("Only '" + lang + "' language will be reimported");
            try {
              int id = Integer.parseInt(lang);
              importInit.loadLanguagesFile(id);
            } catch (NumberFormatException e) {
              importInit.loadLanguagesFile(lang);
            }
          } else {
            System.out.println("All language files will be reimported");
            importInit.loadLanguagesFiles();
          }
        } catch (Exception e) {
          handleError("Language reimport failed", e);
        }
        break;
View Full Code Here

          }
          if (cmdl.hasOption("file")) {
            File backup = checkRestoreFile(file);
            dropDB(connectionProperties);
           
            ImportInitvalues importInit = getApplicationContext(ctxName).getBean(ImportInitvalues.class);
            importInit.loadSystem(cfg, force);
            restoreOm(ctxName, backup);
          } else {
            checkAdminDetails(ctxName);
            dropDB(connectionProperties);
           
            ImportInitvalues importInit = getApplicationContext(ctxName).getBean(ImportInitvalues.class);
            importInit.loadAll(cfg, force);
          }         
         
          InstallationDocumentHandler.createDocument(3);
        } catch(Exception e) {
          handleError("Install failed", e);
        }
        break;
      case backup:
        try {
          File f;
          if (!cmdl.hasOption("file")) {
            file = "backup_" + CalendarPatterns.getTimeForStreamId(new Date()) + ".zip";
            f = new File(home, file);
            System.out.println("File name was not specified, '" + file + "' will be used");
          } else {
            f = new File(file);
          }
          boolean includeFiles = !cmdl.hasOption("exclude-files");
          File backup_dir = new File(OmFileHelper.getUploadTempDir(), "" + System.currentTimeMillis());
          backup_dir.mkdirs();
         
          BackupExport export = getApplicationContext(ctxName).getBean(BackupExport.class);
          export.performExport(f, backup_dir, includeFiles);
          FileHelper.removeRec(backup_dir);
          backup_dir.delete();
        } catch (Exception e) {
          handleError("Backup failed", e);
        }
        break;
      case restore:
        try {
          restoreOm(ctxName, checkRestoreFile(file));
        } catch (Exception e) {
          handleError("Restore failed", e);
        }
        break;
      case languages:
        System.out.println("All language files will be reimported");
        try {
          ImportInitvalues importInit = getApplicationContext(ctxName).getBean(ImportInitvalues.class);
          if (cmdl.hasOption("lang")) {
            String lang = cmdl.getOptionValue("lang");
            System.out.println("Only '" + lang + "' language will be reimported");
            try {
              int id = Integer.parseInt(lang);
              importInit.loadLanguagesFile(id);
            } catch (NumberFormatException e) {
              importInit.loadLanguagesFile(lang);
            }
          } else {
            System.out.println("All language files will be reimported");
            importInit.loadLanguagesFiles();
          }
        } catch (Exception e) {
          handleError("Language reimport failed", e);
        }
        break;
View Full Code Here

          }
          if (cmdl.hasOption("file")) {
            File backup = checkRestoreFile(file);
            dropDB(connectionProperties);
           
            ImportInitvalues importInit = getApplicationContext(ctxName).getBean(ImportInitvalues.class);
            importInit.loadSystem(cfg, force);
            restoreOm(ctxName, backup);
          } else {
            checkAdminDetails(ctxName);
            dropDB(connectionProperties);
           
            ImportInitvalues importInit = getApplicationContext(ctxName).getBean(ImportInitvalues.class);
            importInit.loadAll(cfg, force);
          }         
         
          InstallationDocumentHandler.createDocument(3);
        } catch(Exception e) {
          handleError("Install failed", e);
        }
        break;
      case backup:
        try {
          File f;
          if (!cmdl.hasOption("file")) {
            file = "backup_" + CalendarPatterns.getTimeForStreamId(new Date()) + ".zip";
            f = new File(home, file);
            System.out.println("File name was not specified, '" + file + "' will be used");
          } else {
            f = new File(file);
          }
          boolean includeFiles = Boolean.parseBoolean(cmdl.getOptionValue("exclude-files", "true"));
          File backup_dir = new File(OmFileHelper.getUploadTempDir(), "" + System.currentTimeMillis());
          backup_dir.mkdirs();
         
          BackupExport export = getApplicationContext(ctxName).getBean(BackupExport.class);
          export.performExport(f, backup_dir, includeFiles);
          FileHelper.removeRec(backup_dir);
          backup_dir.delete();
        } catch (Exception e) {
          handleError("Backup failed", e);
        }
        break;
      case restore:
        try {
          restoreOm(ctxName, checkRestoreFile(file));
        } catch (Exception e) {
          handleError("Restore failed", e);
        }
        break;
      case languages:
        System.out.println("All language files will be reimported");
        try {
          ImportInitvalues importInit = getApplicationContext(ctxName).getBean(ImportInitvalues.class);
          if (cmdl.hasOption("lang")) {
            String lang = cmdl.getOptionValue("lang");
            System.out.println("Only '" + lang + "' language will be reimported");
            try {
              int id = Integer.parseInt(lang);
              importInit.loadLanguagesFile(id);
            } catch (NumberFormatException e) {
              importInit.loadLanguagesFile(lang);
            }
          } else {
            System.out.println("All language files will be reimported");
            importInit.loadLanguagesFiles();
          }
        } catch (Exception e) {
          handleError("Language reimport failed", e);
        }
        break;
View Full Code Here

      if (invalidPassword(cfg.password, cfgDao)) {
        System.out.println("Password was not provided, or too short, should be at least " + getMinPasswdLength(cfgDao) + " character long.");
        System.exit(1);
      }
    }
    ImportInitvalues importInit = getApplicationContext(ctxName).getBean(ImportInitvalues.class);
    Map<String, String> tzMap = ImportHelper.getAllTimeZones(importInit.getTimeZones());
    cfg.ical_timeZone = null;
    if (cmdl.hasOption("tz")) {
      cfg.ical_timeZone = cmdl.getOptionValue("tz");
      cfg.ical_timeZone = tzMap.containsKey(cfg.ical_timeZone) ? cfg.ical_timeZone : null;
    }
View Full Code Here

TOP

Related Classes of org.apache.openmeetings.installation.ImportInitvalues

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.