JAL-3851 tidy up REMOVEME logging
authorBen Soares <b.soares@dundee.ac.uk>
Thu, 2 Sep 2021 19:24:53 +0000 (20:24 +0100)
committerBen Soares <b.soares@dundee.ac.uk>
Thu, 2 Sep 2021 19:24:53 +0000 (20:24 +0100)
src/jalview/rest/API.java
src/jalview/rest/EndpointAsync.java
src/jalview/rest/FetchSequenceEndpoint.java
src/jalview/rest/OpenAlignmentEndpoint.java
src/jalview/rest/RestHandler.java

index b13100b..e7b2ced 100644 (file)
@@ -4,8 +4,6 @@ import java.net.BindException;
 import java.util.HashMap;
 import java.util.Map;
 
-import jalview.bin.Cache;
-
 public class API extends RestHandler
 {
   private static final String MY_PATH = "api";
@@ -49,12 +47,6 @@ public class API extends RestHandler
     addEndpoint(new OpenAlignmentEndpoint(this));
     addEndpoint(new HighlightSequenceEndpoint(this));
 
-    Cache.info("REMOVEME setting path to " + MY_PATH);
-    Cache.info("REMOVEME endpoints keys:");
-    for (String key : getEndpoints().keySet())
-    {
-      Cache.info("REMOVEME keyname=" + key);
-    }
     setPath(MY_PATH);
     this.registerHandler();
 
index 57ae865..ff11db1 100644 (file)
@@ -86,18 +86,14 @@ public abstract class EndpointAsync extends Endpoint
           HttpServletResponse response)
   {
     // subclass method
-    Cache.info("**************REMOVEME about to run initialise()");
     initialise(request, response);
 
-    Cache.info("**************REMOVEME about to run checkStatus()");
     if (checkStatus(request, response, Status.STARTED))
     {
       returnStatus(response);
       return;
     }
 
-    Cache.info(
-            "**************REMOVEME about to run getCompletableFuture()");
     if (getCompletableFuture() == null)
     {
       final Map<String, String> finalMap = stringMap;
@@ -106,25 +102,13 @@ public abstract class EndpointAsync extends Endpoint
         this.process(request, response, finalMap);
       }));
     }
-    else
-    {
-      Cache.info(
-              "####################REMOVEME CompletableFuture cf is already set cf="
-                      + cf);
-    }
-    Cache.info(
-            "####################REMOVEME about to run finaliseCompletableFuture()");
     finaliseCompletableFuture();
 
     // subclass method
     finalise(request, response);
 
-    Cache.info("REMOVEME about to run returnStatus");
     returnStatus(response);
-    Cache.info("REMOVEME about to change status for id=" + getId());
     changeStatus(Status.IN_PROGRESS);
-    Cache.info("REMOVEME now changed status for id=" + getId()
-            + " to status=" + getStatus());
   }
 
   protected void atEnd()
@@ -138,12 +122,9 @@ public abstract class EndpointAsync extends Endpoint
   protected String setId(HttpServletRequest request, String extension)
   {
     String idString = request.getParameter("id");
-    Cache.info("REMOVEME setting extension=" + extension);
-    Cache.info("REMOVEME idString=" + idString);
     if (idString == null)
     {
       setIdExtension(extension);
-      Cache.info("REMOVEME id now " + getId());
     }
     else
     {
@@ -175,34 +156,19 @@ public abstract class EndpointAsync extends Endpoint
       if (id != null)
       {
         writer.write("id=" + id + "\n");
-        Cache.info("REMOVEME returnStatus id=" + id);
       }
       if (api.getRequestMap().get(id) != null)
       {
         writer.write(
                 "request=" + api.getRequestMap().get(id).toString() + "\n");
-        Cache.info("REMOVEME returnStatus request="
-                + api.getRequestMap().get(id).toString());
       }
       if (getStatus() != null)
       {
         if (getStatus() == Status.ERROR)
         {
           response.setStatus(500);
-          Cache.info("REMOVEME returnStatus setting HTTP status to " + 500);
         }
         writer.write("status=" + getStatus().toString() + "\n");
-        Cache.info(
-                "REMOVEME returnStatus status=" + getStatus().toString());
-      }
-      if (getCompletableFuture() != null)
-      {
-        boolean isDone = getCompletableFuture().isDone();
-        boolean isError = getCompletableFuture().isCompletedExceptionally();
-        writer.write("cf.isDone=" + isDone + "\n");
-        writer.write("cf.isError=" + isError + "\n");
-        Cache.info("REMOVEME returnStatus cf.isDone=" + isDone);
-        Cache.info("REMOVEME returnStatus cf.isError=" + isDone);
       }
     } catch (IOException e)
     {
@@ -220,11 +186,9 @@ public abstract class EndpointAsync extends Endpoint
           HttpServletResponse response, Status set)
   {
     String id = getId();
-    Cache.info("REMOVEME checkStatus id=" + id);
     Status status = getStatus();
     if (status == null)
     {
-      Cache.info("REMOVEME checkStatus status is " + null);
       if (set != null)
         changeStatus(set);
       api.getRequestMap().put(id, request.getRequestURI());
@@ -232,7 +196,6 @@ public abstract class EndpointAsync extends Endpoint
     }
     else
     {
-      Cache.info("REMOVEME checkStatus status=" + status.toString());
       return true;
     }
   }
@@ -240,7 +203,6 @@ public abstract class EndpointAsync extends Endpoint
   protected void finaliseCompletableFuture()
   {
     String id = getId();
-    Cache.info("######################REMOVEME setting whenComplete on cf");
     cf.whenComplete((Void, e) -> {
       if (e != null)
       {
index 2f6ef37..8bf54c2 100644 (file)
@@ -43,11 +43,9 @@ public class FetchSequenceEndpoint extends EndpointAsync
       return;
 
     String db = DBRefUtils.getCanonicalName(dbName);
-    Cache.info("REMOVEME dbName=" + dbName + ", db=" + db);
     Desktop desktop = Desktop.instance;
     sf = new SequenceFetcher(desktop, db, dbId);
     setCompletableFuture(sf.ok_actionPerformed(true));
-    Cache.info("REMOVEME got CompletableFuture cf=" + cf);
   }
 
   protected void process(HttpServletRequest request,
index d9545b1..7e4b472 100644 (file)
@@ -54,12 +54,10 @@ public class OpenAlignmentEndpoint extends EndpointAsync
     urlString = request.getParameter("url");
     method = request.getMethod().toLowerCase();
     dataString = request.getParameter("data");
-    Cache.info("REMOVEME dataString=" + dataString);
     body = null;
     post = method.equalsIgnoreCase("post");
     data = dataString != null;
 
-    Cache.info("REMOVEME urlString=" + urlString);
     if (post)
     {
       access = "post";
@@ -132,11 +130,9 @@ public class OpenAlignmentEndpoint extends EndpointAsync
   protected void process(HttpServletRequest request,
           HttpServletResponse response, final Map<String, String> finalMap)
   {
-    Cache.info("REMOVEME finalMap=" + finalMap);
     String content = finalMap.get("content");
     if (post || data)
     {
-      Cache.info("REMOVEME content=" + content);
       // Sequence file contents being posted
       // use File -> Input Alignment -> from Textbox
       CutAndPasteTransfer cap = new CutAndPasteTransfer();
index 9320c02..c2d1378 100644 (file)
@@ -146,9 +146,6 @@ public class RestHandler extends AbstractRequestHandler
 
     String endpointName = getRequestedEndpointName(request);
 
-    Cache.info("REMOVEME endpointName=" + endpointName);
-    Cache.info("REMOVEME endpoints[" + endpointName + "]="
-            + endpoints.get(endpointName));
     if (!endpoints.containsKey(endpointName)
             || endpoints.get(endpointName) == null)
     {
@@ -204,10 +201,7 @@ public class RestHandler extends AbstractRequestHandler
     {
       endpoints = new HashMap<>();
     }
-    Cache.info("REMOVEME Adding Endpoint ep=" + ep);
-    Cache.info("REMOVEME Adding Endpoint ep.getName()=" + ep.getName());
     Endpoint e = (Endpoint) ep;
-    Cache.info("REMOVEME Adding Endpoint e.name=" + e.name);
     endpoints.put(ep.getName(), ep);
     return true;
   }