/*.................................................................................................................*/
 boolean checkUsernamePassword(boolean tellUserAboutCipres) {
   if (StringUtil.blank(username) || StringUtil.blank(password)) {
     MesquiteBoolean answer = new MesquiteBoolean(false);
     MesquiteString usernameString = new MesquiteString();
     if (username != null) usernameString.setValue(username);
     MesquiteString passwordString = new MesquiteString();
     if (password != null) passwordString.setValue(password);
     String help =
         "You will need an account on the CIPRes REST system to use this service.  To register, go to https://www.phylo.org/restusers/register.action";
     new UserNamePasswordDialog(
         ownerModule.containerOfModule(),
         "Sign in to CIPRes",
         help,
         "",
         "Username",
         "Password",
         answer,
         usernameString,
         passwordString);
     if (answer.getValue()) {
       username = usernameString.getValue();
       password = passwordString.getValue();
     }
     ownerModule.storePreferences();
   }
   boolean success = StringUtil.notEmpty(username) && StringUtil.notEmpty(password);
   if (!success && tellUserAboutCipres) {
     MesquiteMessage.discreetNotifyUser(
         "Use of the CIPRes service requires an account with CIPRes's REST service.  Go to https://www.phylo.org/restusers/register.action to register for an account");
   }
   return success;
 }
  /*.................................................................................................................*/
  public boolean monitorAndCleanUpShell(String jobURL) {
    boolean stillGoing = true;

    if (!checkUsernamePassword(true)) {
      return false;
    }
    lastModified = null;
    if (outputFilePaths != null) {
      lastModified = new long[outputFilePaths.length];
      LongArray.deassignArray(lastModified);
    }
    String status = "";
    while (!jobCompleted(jobURL) && stillGoing) {
      if (StringUtil.blank(status))
        ownerModule.logln(
            "CIPRes Job Status: " + getJobStatus(jobURL) + "  (" + StringUtil.getDateTime() + ")");

      //	if (jobSubmitted(jobURL))
      //		processOutputFiles();
      try {
        Thread.sleep(minPollIntervalSeconds * 1000);
      } catch (InterruptedException e) {
        MesquiteMessage.notifyProgrammer("InterruptedException in CIPRes monitoring");
        return false;
      }

      stillGoing = watcher == null || watcher.continueShellProcess(null);
      String newStatus = getJobStatus(jobURL);
      if (newStatus != null && !newStatus.equalsIgnoreCase(status)) {
        ownerModule.logln(
            "CIPRes Job Status: " + newStatus + "  (" + StringUtil.getDateTime() + ")");
        status = newStatus;
      } else ownerModule.log(".");
      if (newStatus != null && newStatus.equalsIgnoreCase("SUBMITTED")) { // job is running
        processOutputFiles(jobURL);
      }
    }
    ownerModule.logln("CIPRes job completed.");
    if (outputFileProcessor != null) {
      if (rootDir != null) {
        ownerModule.logln("About to download results from CIPRes.");
        if (downloadResults(jobURL, rootDir, false))
          outputFileProcessor.processCompletedOutputFiles(outputFilePaths);
        else return false;
      }
    }

    return true;
  }