JAL-3949 - refactor logging from jalview.bin.Cache to jalview.bin.Console
[jalview.git] / src / jalview / gui / VamsasApplication.java
index 7881ec9..9defed4 100644 (file)
@@ -21,6 +21,7 @@
 package jalview.gui;
 
 import jalview.bin.Cache;
+import jalview.bin.Console;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.ColumnSelection;
 import jalview.datamodel.HiddenColumns;
@@ -201,7 +202,7 @@ public class VamsasApplication implements SelectionSource, VamsasSource
 
     } catch (Exception e)
     {
-      Cache.error("Couldn't instantiate vamsas client !",
+      Console.error("Couldn't instantiate vamsas client !",
               e);
       return false;
     }
@@ -225,12 +226,12 @@ public class VamsasApplication implements SelectionSource, VamsasSource
       }
     } catch (Error e)
     {
-      Cache.warn(
+      Console.warn(
               "Probable SERIOUS VAMSAS client incompatibility - carrying on regardless",
               e);
     } catch (Exception e)
     {
-      Cache.warn(
+      Console.warn(
               "Probable VAMSAS client incompatibility - carrying on regardless",
               e);
     }
@@ -271,12 +272,12 @@ public class VamsasApplication implements SelectionSource, VamsasSource
     addStoreDocumentHandler();
     startSession();
     inInitialUpdate = true;
-    Cache.debug(
+    Console.debug(
             "Jalview loading the Vamsas Session for the first time.");
     dealWithDocumentUpdate(false); // we don't push an update out to the
     inInitialUpdate = false;
     // document yet.
-    Cache.debug("... finished update for the first time.");
+    Console.debug("... finished update for the first time.");
   }
 
   /**
@@ -306,7 +307,7 @@ public class VamsasApplication implements SelectionSource, VamsasSource
       }
     } catch (Exception e)
     {
-      Cache.warn(
+      Console.warn(
               "Exception whilst refreshing jalview windows after a vamsas document update.",
               e);
     }
@@ -320,10 +321,10 @@ public class VamsasApplication implements SelectionSource, VamsasSource
       @Override
       public void run()
       {
-        Cache.info("Jalview updating to the Vamsas Session.");
+        Console.info("Jalview updating to the Vamsas Session.");
 
         dealWithDocumentUpdate(true);
-        Cache.info("Jalview finished updating to the Vamsas Session.");
+        Console.info("Jalview finished updating to the Vamsas Session.");
       }
 
     });
@@ -353,7 +354,7 @@ public class VamsasApplication implements SelectionSource, VamsasSource
     {
       throw new Error("Jalview not connected to Vamsas session");
     }
-    Cache.info("Jalview disconnecting from the Vamsas Session.");
+    Console.info("Jalview disconnecting from the Vamsas Session.");
     try
     {
       if (joinedSession)
@@ -361,12 +362,12 @@ public class VamsasApplication implements SelectionSource, VamsasSource
         boolean ourprompt = this.promptUser;
         this.promptUser = promptUser;
         vclient.finalizeClient();
-        Cache.info("Jalview has left the session.");
+        Console.info("Jalview has left the session.");
         this.promptUser = ourprompt; // restore default value
       }
       else
       {
-        Cache.warn(
+        Console.warn(
                 "JV Client leaving a session that's its not joined yet.");
       }
       joinedSession = false;
@@ -377,13 +378,13 @@ public class VamsasApplication implements SelectionSource, VamsasSource
       vobj2jv = null;
     } catch (Exception e)
     {
-      Cache.error("Vamsas Session finalization threw exceptions!", e);
+      Console.error("Vamsas Session finalization threw exceptions!", e);
     }
   }
 
   public void updateJalview(IClientDocument cdoc)
   {
-    Cache.debug("Jalview updating from sesion document ..");
+    Console.debug("Jalview updating from sesion document ..");
     ensureJvVamsas();
     VamsasAppDatastore vds = new VamsasAppDatastore(cdoc, vobj2jv, jv2vobj,
             baseProvEntry(), alRedoState);
@@ -392,7 +393,7 @@ public class VamsasApplication implements SelectionSource, VamsasSource
       vds.updateToJalview();
     } catch (Exception e)
     {
-      Cache.error("Failed to update Jalview from vamsas document.", e);
+      Console.error("Failed to update Jalview from vamsas document.", e);
     }
     try
     {
@@ -404,10 +405,10 @@ public class VamsasApplication implements SelectionSource, VamsasSource
       }
     } catch (Exception e)
     {
-      Cache.error(
+      Console.error(
               "Exception when updating Jalview settings from Appdata.", e);
     }
-    Cache.debug(".. finished updating from sesion document.");
+    Console.debug(".. finished updating from sesion document.");
 
   }
 
@@ -481,7 +482,7 @@ public class VamsasApplication implements SelectionSource, VamsasSource
             } catch (Exception e)
             {
               errorsDuringUpdate = true;
-              Cache.error("Exception synchronizing " + af.getTitle()
+              Console.error("Exception synchronizing " + af.getTitle()
                       + " "
                       + (af.getViewport().getViewName() == null ? ""
                               : " view " + af.getViewport().getViewName())
@@ -519,7 +520,7 @@ public class VamsasApplication implements SelectionSource, VamsasSource
       }
     } catch (Exception e)
     {
-      Cache.error("Exception synchronizing Views to Document :", e);
+      Console.error("Exception synchronizing Views to Document :", e);
       errorsDuringUpdate = true;
     }
 
@@ -536,7 +537,7 @@ public class VamsasApplication implements SelectionSource, VamsasSource
       }
     } catch (Exception e)
     {
-      Cache.error("Client Appdata Write exception", e);
+      Console.error("Client Appdata Write exception", e);
       errorsDuringAppUpdate = true;
     }
     vds.clearSkipList();
@@ -564,32 +565,32 @@ public class VamsasApplication implements SelectionSource, VamsasSource
   {
     int storedviews = 0;
     // called by update handler for document update.
-    Cache.debug("Updating jalview from changed vamsas document.");
+    Console.debug("Updating jalview from changed vamsas document.");
     disableGui(true);
     try
     {
       long time = System.currentTimeMillis();
       IClientDocument cdoc = vclient.getClientDocument();
-      if (Cache.isDebugEnabled())
+      if (Console.isDebugEnabled())
       {
-        Cache.debug("Time taken to get ClientDocument = "
+        Console.debug("Time taken to get ClientDocument = "
                 + (System.currentTimeMillis() - time));
         time = System.currentTimeMillis();
       }
       if (fromJalview)
       {
         storedviews += updateVamsasDocument(cdoc);
-        if (Cache.isDebugEnabled())
+        if (Console.isDebugEnabled())
         {
-          Cache.debug(
+          Console.debug(
                   "Time taken to update Vamsas Document from jalview\t= "
                           + (System.currentTimeMillis() - time));
           time = System.currentTimeMillis();
         }
         cdoc.setVamsasRoots(cdoc.getVamsasRoots());
-        if (Cache.isDebugEnabled())
+        if (Console.isDebugEnabled())
         {
-          Cache.debug("Time taken to set Document Roots\t\t= "
+          Console.debug("Time taken to set Document Roots\t\t= "
                   + (System.currentTimeMillis() - time));
           time = System.currentTimeMillis();
         }
@@ -597,9 +598,9 @@ public class VamsasApplication implements SelectionSource, VamsasSource
       else
       {
         updateJalview(cdoc);
-        if (Cache.isDebugEnabled())
+        if (Console.isDebugEnabled())
         {
-          Cache.debug(
+          Console.debug(
                   "Time taken to update Jalview from vamsas document Roots\t= "
                           + (System.currentTimeMillis() - time));
           time = System.currentTimeMillis();
@@ -607,9 +608,9 @@ public class VamsasApplication implements SelectionSource, VamsasSource
 
       }
       vclient.updateDocument(cdoc);
-      if (Cache.isDebugEnabled())
+      if (Console.isDebugEnabled())
       {
-        Cache.debug("Time taken to update Session Document\t= "
+        Console.debug("Time taken to update Session Document\t= "
                 + (System.currentTimeMillis() - time));
         time = System.currentTimeMillis();
       }
@@ -623,7 +624,7 @@ public class VamsasApplication implements SelectionSource, VamsasSource
       recover_objectMappingBackup();
       storedviews = 0;
     }
-    Cache.debug("Finished updating from document change.");
+    Console.debug("Finished updating from document change.");
     disableGui(false);
     return storedviews;
   }
@@ -636,12 +637,12 @@ public class VamsasApplication implements SelectionSource, VamsasSource
       @Override
       public void propertyChange(PropertyChangeEvent evt)
       {
-        Cache.debug("Dealing with document update event.");
+        Console.debug("Dealing with document update event.");
         client.dealWithDocumentUpdate(false);
-        Cache.debug("finished dealing with event.");
+        Console.debug("finished dealing with event.");
       }
     });
-    Cache.debug("Added Jalview handler for vamsas document updates.");
+    Console.debug("Added Jalview handler for vamsas document updates.");
   }
 
   private void addStoreDocumentHandler()
@@ -656,7 +657,7 @@ public class VamsasApplication implements SelectionSource, VamsasSource
               {
                 if (client.promptUser)
                 {
-                  Cache.debug(
+                  Console.debug(
                           "Asking user if the vamsas session should be stored.");
                   int reply = JvOptionPane.showInternalConfirmDialog(
                           Desktop.desktop,
@@ -667,21 +668,21 @@ public class VamsasApplication implements SelectionSource, VamsasSource
 
                   if (reply == JvOptionPane.YES_OPTION)
                   {
-                    Cache.debug("Prompting for vamsas store filename.");
+                    Console.debug("Prompting for vamsas store filename.");
                     Desktop.instance.vamsasSave_actionPerformed(null);
-                    Cache.debug("Finished attempt at storing document.");
+                    Console.debug("Finished attempt at storing document.");
                   }
-                  Cache.debug(
+                  Console.debug(
                           "finished dealing with REQUESTTOCLOSE event.");
                 }
                 else
                 {
-                  Cache.debug(
+                  Console.debug(
                           "Ignoring store document request (promptUser==false)");
                 }
               }
             });
-    Cache.debug("Added Jalview handler for vamsas document updates.");
+    Console.debug("Added Jalview handler for vamsas document updates.");
   }
 
   public void disableGui(boolean b)
@@ -755,7 +756,7 @@ public class VamsasApplication implements SelectionSource, VamsasSource
       } catch (Exception e)
       {
         // Complain to GUI
-        Cache.error("Failed to join vamsas session.", e);
+        Console.error("Failed to join vamsas session.", e);
         vclient = null;
       }
       try
@@ -1000,7 +1001,7 @@ public class VamsasApplication implements SelectionSource, VamsasSource
           {
             if (vobj2jv == null)
             {
-              Cache.warn(
+              Console.warn(
                       "Selection listener still active for dead session.");
               // not in a session.
               return;
@@ -1100,7 +1101,7 @@ public class VamsasApplication implements SelectionSource, VamsasSource
               if (sm != null)
               {
                 sm.validate(); // debug
-                Cache.debug("Selection Message\n" + sm.getRawMessage());
+                Console.debug("Selection Message\n" + sm.getRawMessage());
                 pm.sendMessage(sm);
               }
             }
@@ -1111,7 +1112,7 @@ public class VamsasApplication implements SelectionSource, VamsasSource
         ssm.addSelectionListener(selecter);
       } catch (Exception e)
       {
-        Cache.error("Failed to init Vamsas Picking", e);
+        Console.error("Failed to init Vamsas Picking", e);
       }
     }
   }