JAL-3949 Complete new abstracted logging framework in jalview.log. Updated log calls...
[jalview.git] / src / jalview / io / VamsasAppDatastore.java
index 2fc526b..6e0dab0 100644 (file)
@@ -183,7 +183,7 @@ public class VamsasAppDatastore
           Vobject obj = getjv2vObj(seqsetidobj);
           if (obj != null && !(obj instanceof Alignment))
           {
-            Cache.log.warn(
+            Cache.warn(
                     "IMPLEMENTATION ERROR?: Unexpected mapping for unmapped jalview string object content:"
                             + seqsetidobj + " to object " + obj);
           }
@@ -191,16 +191,16 @@ public class VamsasAppDatastore
         }
         else
         {
-          Cache.log.warn("Unexpected mapping for Jalview String Object ID "
+          Cache.warn("Unexpected mapping for Jalview String Object ID "
                   + seqsetidobj + " to another jalview dataset object "
                   + seqsetidobj);
         }
       }
     }
 
-    if (Cache.log.isDebugEnabled())
+    if (Cache.isDebugEnabled())
     {
-      Cache.log.debug(
+      Cache.debug(
               "Returning null VorbaID binding for jalview object " + jvobj);
     }
     return null;
@@ -217,7 +217,7 @@ public class VamsasAppDatastore
     if (id == null)
     {
       id = cdoc.registerObject(vobj);
-      Cache.log.debug(
+      Cache.debug(
               "Registering new object and returning null for getvObj2jv");
       return null;
     }
@@ -237,7 +237,7 @@ public class VamsasAppDatastore
       if (id == null || vobj.getVorbaId() == null
               || cdoc.getObject(id) != vobj)
       {
-        Cache.log.error("Failed to get id for "
+        Cache.error("Failed to get id for "
                 + (vobj.isRegisterable() ? "registerable"
                         : "unregisterable")
                 + " object " + vobj);
@@ -247,7 +247,7 @@ public class VamsasAppDatastore
     if (vobj2jv.containsKey(vobj.getVorbaId())
             && !((VorbaId) vobj2jv.get(vobj.getVorbaId())).equals(jvobj))
     {
-      Cache.log.debug(
+      Cache.debug(
               "Warning? Overwriting existing vamsas id binding for "
                       + vobj.getVorbaId(),
               new Exception(MessageManager.getString(
@@ -256,19 +256,19 @@ public class VamsasAppDatastore
     else if (jv2vobj.containsKey(jvobj)
             && !((VorbaId) jv2vobj.get(jvobj)).equals(vobj.getVorbaId()))
     {
-      Cache.log.debug(
+      Cache.debug(
               "Warning? Overwriting existing jalview object binding for "
                       + jvobj,
               new Exception("Overwriting jalview object binding."));
     }
     /*
-     * Cache.log.error("Attempt to make conflicting object binding! "+vobj+" id "
+     * Cache.error("Attempt to make conflicting object binding! "+vobj+" id "
      * +vobj.getVorbaId()+" already bound to "+getvObj2jv(vobj)+" and "+jvobj+"
      * already bound to "+getjv2vObj(jvobj),new Exception("Excessive call to
      * bindjvvobj")); }
      */
     // we just update the hash's regardless!
-    Cache.log.debug("Binding " + vobj.getVorbaId() + " to " + jvobj);
+    Cache.debug("Binding " + vobj.getVorbaId() + " to " + jvobj);
     vobj2jv.put(vobj.getVorbaId(), jvobj);
     // JBPNote - better implementing a hybrid invertible hash.
     jv2vobj.put(jvobj, vobj.getVorbaId());
@@ -297,7 +297,7 @@ public class VamsasAppDatastore
       DataSet dataset = null;
       if (jds == null)
       {
-        Cache.log.warn("Creating new dataset for an alignment.");
+        Cache.warn("Creating new dataset for an alignment.");
         jal.setDataset(null);
         jds = jal.getDataset();
       }
@@ -349,7 +349,7 @@ public class VamsasAppDatastore
 
       if (dataset == null)
       {
-        Cache.log.warn("Creating new vamsas dataset for alignment view "
+        Cache.warn("Creating new vamsas dataset for alignment view "
                 + av.getSequenceSetId());
         // we create a new dataset on the default vamsas root.
         root = cdoc.getVamsasRoots()[0]; // default vamsas root for modifying.
@@ -556,7 +556,7 @@ public class VamsasAppDatastore
           if (aa[i].groupRef != null)
           {
             // TODO: store any group associated annotation references
-            Cache.log.warn(
+            Cache.warn(
                     "Group associated sequence annotation is not stored in VAMSAS document.");
             continue;
           }
@@ -699,13 +699,13 @@ public class VamsasAppDatastore
               // LOCK METHODS)
               {
                 // verify annotation - update (perhaps)
-                Cache.log.info(
+                Cache.info(
                         "update alignment sequence annotation. not yet implemented.");
               }
               else
               {
                 // verify annotation - update (perhaps)
-                Cache.log.info(
+                Cache.info(
                         "updated alignment sequence annotation added.");
               }
             }
@@ -889,7 +889,7 @@ public class VamsasAppDatastore
     }
     if (getjv2vObj(jvalsq.getDatasetSequence()) == null)
     {
-      Cache.log.warn(
+      Cache.warn(
               "Serious Implementation error - Unbound dataset sequence in alignment: "
                       + jvalsq.getDatasetSequence());
     }
@@ -947,9 +947,9 @@ public class VamsasAppDatastore
         alseq.setDescription(valseq.getDescription());
         modal = true;
       }
-      if (modal && Cache.log.isDebugEnabled())
+      if (modal && Cache.isDebugEnabled())
       {
-        Cache.log.debug(
+        Cache.debug(
                 "Updating apparently edited sequence " + alseq.getName());
       }
     }
@@ -986,7 +986,7 @@ public class VamsasAppDatastore
       }
       else
       {
-        Cache.log.error(
+        Cache.error(
                 "Invalid dataset sequence id (null) for alignment sequence "
                         + valseq.getVorbaId());
       }
@@ -1332,7 +1332,7 @@ public class VamsasAppDatastore
               @Override
               public JarInputStream getJarInputStream() throws IOException
               {
-                jalview.bin.Cache.log.debug(
+                Cache.debug(
                         "Returning client input stream for Jalview from Vamsas Document.");
                 return new JarInputStream(cappdata.getClientInputStream());
               }
@@ -1380,7 +1380,7 @@ public class VamsasAppDatastore
             @Override
             public JarInputStream getJarInputStream() throws IOException
             {
-              jalview.bin.Cache.log.debug(
+              Cache.debug(
                       "Returning user input stream for Jalview from Vamsas Document.");
               return new JarInputStream(cappdata.getUserInputStream());
             }
@@ -1426,8 +1426,7 @@ public class VamsasAppDatastore
       // TODO implement this : af.getNumberOfViews
       String seqsetidobj = av.getSequenceSetId();
       views = Desktop.getViewports(seqsetidobj);
-      Cache.log
-              .debug("Found " + (views == null ? " no " : "" + views.length)
+      Cache.debug("Found " + (views == null ? " no " : "" + views.length)
                       + " views for '" + av.getSequenceSetId() + "'");
       if (views.length > 1)
       {
@@ -1544,14 +1543,14 @@ public class VamsasAppDatastore
       } catch (Exception e)
       {
         // TODO raise GUI warning if user requests it.
-        jalview.bin.Cache.log.error(
+        Cache.error(
                 "Couldn't update jalview client application data. Giving up - local settings probably lost.",
                 e);
       }
     }
     else
     {
-      jalview.bin.Cache.log.error(
+      Cache.error(
               "Couldn't access client application data for vamsas session. This is probably a vamsas client bug.");
     }
   }
@@ -1617,13 +1616,13 @@ public class VamsasAppDatastore
         int jremain = 0;
         if (jdataset == null)
         {
-          Cache.log.debug("Initialising new jalview dataset fields");
+          Cache.debug("Initialising new jalview dataset fields");
           newds = true;
           dsseqs = new Vector();
         }
         else
         {
-          Cache.log.debug("Update jalview dataset from vamsas.");
+          Cache.debug("Update jalview dataset from vamsas.");
           jremain = jdataset.getHeight();
           dsseqs = jdataset.getSequences();
         }
@@ -1663,7 +1662,7 @@ public class VamsasAppDatastore
             dsseqs.set(i, null);
           }
           jdataset = new jalview.datamodel.Alignment(seqs);
-          Cache.log.debug("New vamsas dataset imported into jalview.");
+          Cache.debug("New vamsas dataset imported into jalview.");
           bindjvvobj(jdataset, dataset);
         }
         // ////////
@@ -1683,7 +1682,7 @@ public class VamsasAppDatastore
               // annotations
               if (dsSeq == null)
               {
-                jalview.bin.Cache.log.warn(
+                Cache.warn(
                         "Couldn't resolve jalview sequenceI for dataset object reference "
                                 + ((Vobject) dataset
                                         .getDataSetAnnotations(dsa)
@@ -1704,14 +1703,14 @@ public class VamsasAppDatastore
                   // JBPNote: we could just add them to all alignments but
                   // that may complicate cross references in the jalview
                   // datamodel
-                  Cache.log.warn(
+                  Cache.warn(
                           "Ignoring dataset annotation with annotationElements. Not yet supported in jalview.");
                 }
               }
             }
             else
             {
-              Cache.log.warn(
+              Cache.warn(
                       "Ignoring multiply referenced dataset sequence annotation for binding to datsaet sequence features.");
             }
           }
@@ -1807,7 +1806,7 @@ public class VamsasAppDatastore
                     // OBJECT LOCK
                     // METHODS)
                     {
-                      Cache.log.info(
+                      Cache.info(
                               "UNIMPLEMENTED: not recovering user modifiable sequence alignment annotation");
                       // TODO: should at least replace with new one - otherwise
                       // things will break
@@ -1831,7 +1830,7 @@ public class VamsasAppDatastore
                 dsseqs.set(i, null);
               }
               jal = new jalview.datamodel.Alignment(seqs);
-              Cache.log.debug("New vamsas alignment imported into jalview "
+              Cache.debug("New vamsas alignment imported into jalview "
                       + alignment.getVorbaId().getId());
               jal.setDataset(jdataset);
             }
@@ -1870,7 +1869,7 @@ public class VamsasAppDatastore
                   // jan.update(getjAlignmentAnnotation(jal, an[a])); // update
                   // from another annotation object in place.
 
-                  Cache.log.debug(
+                  Cache.debug(
                           "update from vamsas alignment annotation to existing jalview alignment annotation.");
                   if (an[j].getModifiable() == null) // TODO: USE VAMSAS
                   // LIBRARY OBJECT LOCK
@@ -1878,7 +1877,7 @@ public class VamsasAppDatastore
                   {
                     // TODO: user defined annotation is totally mutable... - so
                     // load it up or throw away if locally edited.
-                    Cache.log.info(
+                    Cache.info(
                             "NOT IMPLEMENTED - Recovering user-modifiable annotation - yet...");
                   }
                   // TODO: compare annotation element rows
@@ -1898,7 +1897,7 @@ public class VamsasAppDatastore
             AlignFrame alignFrame;
             if (av == null)
             {
-              Cache.log.debug("New alignframe for alignment "
+              Cache.debug("New alignframe for alignment "
                       + alignment.getVorbaId());
               // ///////////////////////////////
               // construct alignment view
@@ -1924,7 +1923,7 @@ public class VamsasAppDatastore
               }
               // TODO: automatically create meaningful title for a vamsas
               // alignment using its provenance.
-              if (Cache.log.isDebugEnabled())
+              if (Cache.isDebugEnabled())
               {
                 title = title + "(" + alignment.getVorbaId() + ")";
 
@@ -1971,12 +1970,12 @@ public class VamsasAppDatastore
                     vstree.UpdateSequenceTreeMap(tp);
                   } catch (RuntimeException e)
                   {
-                    Cache.log.warn("update of labels failed.", e);
+                    Cache.warn("update of labels failed.", e);
                   }
                 }
                 else
                 {
-                  Cache.log.warn("Cannot create tree for tree " + t
+                  Cache.warn("Cannot create tree for tree " + t
                           + " in document ("
                           + alignment.getTree(t).getVorbaId());
                 }
@@ -2073,7 +2072,7 @@ public class VamsasAppDatastore
           if (anot[row][pos] != null)
           {
             // only time this should happen is if the After flag is set.
-            Cache.log.debug("Ignoring duplicate annotation site at " + pos);
+            Cache.debug("Ignoring duplicate annotation site at " + pos);
             continue;
           }
           if (anot[1 - row][pos] != null)
@@ -2109,7 +2108,7 @@ public class VamsasAppDatastore
               else if (glyphs[g].getDict().equals(
                       uk.ac.vamsas.objects.utils.GlyphDictionary.PROTEIN_HD_HYDRO))
               {
-                Cache.log.debug("ignoring hydrophobicity glyph marker.");
+                Cache.debug("ignoring hydrophobicity glyph marker.");
                 AeContent[HASHPHOB] = true;
                 char c = (dc = glyphs[g].getContent()).charAt(0);
                 // dc may get overwritten - but we still set the colour.
@@ -2125,7 +2124,7 @@ public class VamsasAppDatastore
               }
               else
               {
-                Cache.log.debug(
+                Cache.debug(
                         "IMPLEMENTATION TODO: Ignoring unknown glyph type "
                                 + glyphs[g].getDict());
               }
@@ -2137,7 +2136,7 @@ public class VamsasAppDatastore
             AeContent[HASVALS] = true;
             if (ae[aa].getValueCount() > 1)
             {
-              Cache.log.warn(
+              Cache.warn(
                       "ignoring additional " + (ae[aa].getValueCount() - 1)
                               + " values in annotation element.");
             }
@@ -2158,7 +2157,7 @@ public class VamsasAppDatastore
         }
         else
         {
-          Cache.log.warn("Ignoring out of bound annotation element " + aa
+          Cache.warn("Ignoring out of bound annotation element " + aa
                   + " in " + annotation.getVorbaId().getId());
         }
       }
@@ -2249,7 +2248,7 @@ public class VamsasAppDatastore
             val = Float.valueOf(props[p].getContent());
           } catch (Exception e)
           {
-            Cache.log.warn("Failed to parse threshold property");
+            Cache.warn("Failed to parse threshold property");
           }
           if (val != null)
           {
@@ -2289,14 +2288,14 @@ public class VamsasAppDatastore
     }
     if (parsedRangeAnnotation == null)
     {
-      Cache.log.debug(
+      Cache.debug(
               "Inserting empty annotation row elements for a whole-alignment annotation.");
     }
     else
     {
       if (parsedRangeAnnotation[3] != null)
       {
-        Cache.log.warn("Ignoring 'After' annotation row in "
+        Cache.warn("Ignoring 'After' annotation row in "
                 + annotation.getVorbaId());
       }
       jalview.datamodel.Annotation[] arow = (jalview.datamodel.Annotation[]) parsedRangeAnnotation[2];
@@ -2416,7 +2415,7 @@ public class VamsasAppDatastore
       }
       if (annotation.getLinkCount() > 0)
       {
-        Cache.log.warn("Ignoring " + annotation.getLinkCount()
+        Cache.warn("Ignoring " + annotation.getLinkCount()
                 + "links added to AlignmentAnnotation.");
       }
       if (annotation.getModifiable() == null
@@ -2441,7 +2440,7 @@ public class VamsasAppDatastore
         }
       } catch (Exception e)
       {
-        Cache.log.info(
+        Cache.info(
                 "UNIMPLEMENTED : Couldn't parse non-integer group value for setting graphGroup correctly.");
       }
       return jan;
@@ -2737,7 +2736,7 @@ public class VamsasAppDatastore
       DataSet dataset = null;
       if (jal.getDataset() == null)
       {
-        Cache.log.warn("Creating new dataset for an alignment.");
+        Cache.warn("Creating new dataset for an alignment.");
         jal.setDataset(null);
       }
       dataset = (DataSet) ((Alignment) getjv2vObj(
@@ -2745,7 +2744,7 @@ public class VamsasAppDatastore
       if (dataset == null)
       {
         dataset = (DataSet) getjv2vObj(jal.getDataset());
-        Cache.log.error(
+        Cache.error(
                 "Can't find the correct dataset for the alignment in this view. Creating new one.");
 
       }
@@ -2770,7 +2769,7 @@ public class VamsasAppDatastore
               }
               else
               {
-                Cache.log.warn(
+                Cache.warn(
                         "NO Vamsas Binding for local sequence! NOT CREATING MAPPING FOR "
                                 + dmps[smp].getDisplayId(true) + " to "
                                 + mps[smp].getTo().getName());