Merge branch 'develop' into update_212_Dec_merge_with_21125_chamges
[jalview.git] / src / jalview / ws / rest / RestJobThread.java
index cff127b..0895f0f 100644 (file)
@@ -22,7 +22,7 @@ package jalview.ws.rest;
 
 import java.util.Locale;
 
-import jalview.bin.Cache;
+import jalview.bin.Console;
 import jalview.datamodel.Alignment;
 import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.AlignmentI;
@@ -262,7 +262,7 @@ public class RestJobThread extends AWSThread
                 + "</a><br>See Console output for details.";
         rj.setAllowedServerExceptions(0);// unrecoverable;
         rj.error = true;
-        Cache.log.fatal("Unexpected REST Job " + getStage(stg)
+        Console.fatal("Unexpected REST Job " + getStage(stg)
                 + "exception for URL " + rj.rsd.postUrl);
         throw (he);
       } catch (IOException e)
@@ -271,7 +271,7 @@ public class RestJobThread extends AWSThread
                 + "Job. <br>Problematic url was <a href=\""
                 + request.getURI() + "\">" + request.getURI()
                 + "</a><br>See Console output for details.";
-        Cache.log.warn("IO Exception for REST Job " + getStage(stg)
+        Console.warn("IO Exception for REST Job " + getStage(stg)
                 + "exception for URL " + rj.rsd.postUrl);
 
         throw (e);
@@ -280,14 +280,12 @@ public class RestJobThread extends AWSThread
       {
       case 200:
         rj.running = false;
-        Cache.log.debug("Processing result set.");
+        Console.debug("Processing result set.");
         processResultSet(rj, response, request);
         break;
-
       case 202:
         markJobAsRunning(rj);
         break;
-
       case 201:
         // Created - redirect may be present. Fallthrough to 302
       case 302:
@@ -302,7 +300,7 @@ public class RestJobThread extends AWSThread
       default:
         // Some other response. Probably need to pop up the content in a window.
         // TODO: deal with all other HTTP response codes from server.
-        Cache.log.warn("Unhandled response status when " + getStage(stg)
+        Console.warn("Unhandled response status when " + getStage(stg)
                 + "for " + postUrl + ": " + response.getStatusLine());
         rj.error = true;
         rj.setAllowedServerExceptions(0);
@@ -316,8 +314,7 @@ public class RestJobThread extends AWSThread
                   + "</a><br/>Filtered response content below:<br/>");
         } catch (IOException e)
         {
-          Cache.log.debug("IOException when consuming unhandled response",
-                  e);
+          Console.debug("IOException when consuming unhandled response", e);
         }
         ;
       }
@@ -370,8 +367,7 @@ public class RestJobThread extends AWSThread
       {
         if (loc.length > 1)
         {
-          Cache.log
-                  .warn("Ignoring additional "
+          Console.warn("Ignoring additional "
                           + (loc.length - 1)
                           + " location(s) provided in response header ( next one is '"
                           + loc[1].getValue() + "' )");
@@ -381,7 +377,6 @@ public class RestJobThread extends AWSThread
       }
     }
   }
-
   /**
    * job has completed. Something valid should be available from con
    * 
@@ -481,7 +476,7 @@ public class RestJobThread extends AWSThread
     {
       job.setSubjobComplete(true);
       job.setAllowedServerExceptions(-1);
-      Cache.log.error("Exception when trying to start Rest Job.", ex);
+      Console.error("Exception when trying to start Rest Job.", ex);
     }
   }
 
@@ -490,7 +485,7 @@ public class RestJobThread extends AWSThread
   {
     // crazy users will see this message
     // TODO: finish this! and remove the message below!
-    Cache.log.warn("Rest job result parser is currently INCOMPLETE!");
+    Console.warn("Rest job result parser is currently INCOMPLETE!");
     int validres = 0;
     for (RestJob rj : (RestJob[]) jobs)
     {
@@ -499,22 +494,22 @@ public class RestJobThread extends AWSThread
         String ln = null;
         try
         {
-          Cache.log.debug("Parsing data for job " + rj.getJobId());
+          Console.debug("Parsing data for job " + rj.getJobId());
           rj.parseResultSet();
           if (rj.hasResults())
           {
             validres++;
           }
-          Cache.log.debug("Finished parsing data for job " + rj.getJobId());
+          Console.debug("Finished parsing data for job " + rj.getJobId());
 
         } catch (Error ex)
         {
-          Cache.log.warn(
+          Console.warn(
                   "Failed to finish parsing data for job " + rj.getJobId());
           ex.printStackTrace();
         } catch (Exception ex)
         {
-          Cache.log.warn(
+          Console.warn(
                   "Failed to finish parsing data for job " + rj.getJobId());
           ex.printStackTrace();
         } finally
@@ -611,12 +606,12 @@ public class RestJobThread extends AWSThread
     /**
      * alignment panels derived from each alignment set returned by service.
      */
-    ArrayList<jalview.gui.AlignmentPanel> destPanels = new ArrayList<>();
+    ArrayList<jalview.gui.AlignmentPanel> destPanels = new ArrayList<jalview.gui.AlignmentPanel>();
     /**
      * list of instructions for how to process each distinct alignment set
      * returned by the job set
      */
-    ArrayList<AddDataTo> resultDest = new ArrayList<>();
+    ArrayList<AddDataTo> resultDest = new ArrayList<AddDataTo>();
     /**
      * when false, zeroth pane is panel derived from input deta.
      */
@@ -635,9 +630,9 @@ public class RestJobThread extends AWSThread
     boolean vsepjobs = restClient.service.isVseparable();
     // total number of distinct alignment sets generated by job set.
     int numAlSets = 0, als = 0;
-    List<AlignmentI> destAls = new ArrayList<>();
-    List<jalview.datamodel.HiddenColumns> destColsel = new ArrayList<>();
-    List<List<NewickFile>> trees = new ArrayList<>();
+    List<AlignmentI> destAls = new ArrayList<AlignmentI>();
+    List<jalview.datamodel.HiddenColumns> destColsel = new ArrayList<jalview.datamodel.HiddenColumns>();
+    List<List<NewickFile>> trees = new ArrayList<List<NewickFile>>();
 
     do
     {
@@ -696,7 +691,7 @@ public class RestJobThread extends AWSThread
 
               if (alset.trees != null)
               {
-                trees.add(new ArrayList<>(alset.trees));
+                trees.add(new ArrayList<NewickFile>(alset.trees));
               }
               else
               {
@@ -724,8 +719,8 @@ public class RestJobThread extends AWSThread
        */
       int vrestjob = 0;
       // Destination alignments for all result data.
-      ArrayList<SequenceGroup> visgrps = new ArrayList<>();
-      Hashtable<String, SequenceGroup> groupNames = new Hashtable<>();
+      ArrayList<SequenceGroup> visgrps = new ArrayList<SequenceGroup>();
+      Hashtable<String, SequenceGroup> groupNames = new Hashtable<String, SequenceGroup>();
       ArrayList<AlignmentAnnotation> visAlAn = null;
       for (nvertsep = 0; nvertsep < nvertseps; nvertsep++)
       {
@@ -790,7 +785,7 @@ public class RestJobThread extends AWSThread
               {
                 // TODO: decide if multiple multiple alignments returned by
                 // non-vseparable services are allowed.
-                Cache.log.warn(
+                Console.warn(
                         "dealing with multiple alignment products returned by non-vertically separable service.");
               }
               // recover reference to last alignment created for this rest frame
@@ -904,7 +899,7 @@ public class RestJobThread extends AWSThread
                     }
                     else
                     {
-                      Cache.log.warn(
+                      Console.warn(
                               "Couldn't resolve original sequence for new sequence.");
                     }
                   }
@@ -982,14 +977,14 @@ public class RestJobThread extends AWSThread
                   grass = groupNames.get(alan[nrj][an].groupRef.getName());
                   if (grass == null)
                   {
-                    Cache.log.error(
+                    Console.error(
                             "Couldn't relocate group referemce for group "
                                     + alan[nrj][an].groupRef.getName());
                   }
                 }
                 if (visAlAn == null)
                 {
-                  visAlAn = new ArrayList<>();
+                  visAlAn = new ArrayList<AlignmentAnnotation>();
                 }
                 AlignmentAnnotation visan = null;
                 for (AlignmentAnnotation v : visAlAn)
@@ -1033,7 +1028,7 @@ public class RestJobThread extends AWSThread
               {
                 // TODO: process each newick file, lifting over sequence refs to
                 // current alignment, if necessary.
-                Cache.log.error(
+                Console.error(
                         "Tree recovery from restjob not yet implemented.");
               }
             }
@@ -1285,7 +1280,7 @@ public class RestJobThread extends AWSThread
    */
   public boolean isValid()
   {
-    ArrayList<String> _warnings = new ArrayList<>();
+    ArrayList<String> _warnings = new ArrayList<String>();
     boolean validt = true;
     if (jobs != null)
     {