Example #1
0
 protected void consolidateLibDir(File tomcatRoot) {
   Set<String> requiredLibs = _differ.getRequiredLibNames();
   for (String lib : _differ.getInstalledLibNames()) {
     if (lib.startsWith("h2-")) continue; // h2 db driver is also needed
     if (!requiredLibs.contains(lib)) {
       FileUtil.delete(tomcatRoot, FileUtil.buildPath("yawllib", lib));
     }
   }
 }
Example #2
0
 protected List<AppUpdate> getInstallList(List<UpdateRow> updateRows) {
   List<AppUpdate> upList = new ArrayList<AppUpdate>();
   for (UpdateRow row : updateRows) {
     String appName = row.getName();
     if (row.isAdding()) {
       upList.add(_differ.getAppFiles(appName, true));
       upList.add(_differ.getAppLibs(appName));
     } else if (row.isRemoving()) {
       upList.add(_differ.getAppFiles(appName, false));
     }
   }
   return upList;
 }
Example #3
0
 protected List<AppUpdate> getUpdatesList() {
   try {
     return _differ.getUpdatesList();
   } catch (IllegalStateException ise) {
     showError(ise.getMessage());
     return Collections.emptyList();
   }
 }
Example #4
0
  private void restartApp() {
    if (!updateThis()) {
      JOptionPane.showMessageDialog(
          getProgressPanel().getParent(),
          "The update has completed successfully, but the control panel "
              + "was unable to restart itself automatically. Please close then "
              + "restart the control panel manually to use the updated version.",
          "Update Completed",
          JOptionPane.WARNING_MESSAGE);
      return;
    }
    String javaBin =
        System.getProperty("java.home") + File.separator + "bin" + File.separator + "java";
    try {
      String appPath = FileUtil.getJarFile().getPath();
      String newJarName = _differ.getNewJarName();
      if (!(newJarName == null || appPath.endsWith(newJarName))) {
        appPath = getPathForNewAppName(appPath);
        if (appPath == null) {
          throw new IllegalArgumentException();
        }
      }

      java.util.List<String> command = new ArrayList<String>();
      command.add(javaBin);
      command.add("-jar");
      command.add(FileUtil.getJarFile().getPath());
      command.add("-updateCompleted");

      ProcessBuilder builder = new ProcessBuilder(command);
      builder.start();
      System.exit(0);
    } catch (Exception e) {
      showError("Failed to restart the Control Panel. Please restart manually.");
    }
  }
Example #5
0
 private String getPathForNewAppName(String appPath) {
   return appPath == null ? null : getPathPart(appPath) + _differ.getNewJarName();
 }