[Webfunds-commits] java/webfunds/comms BasicCommsManager.java HttpAgent.java HttpSocketAgent.java RawHttp.java URLSupport.java

Ian Grigg iang@cypherpunks.ai
Thu, 12 Apr 2001 01:07:52 -0400 (AST)


iang        01/04/12 01:07:52

  Modified:    webfunds/comms BasicCommsManager.java HttpAgent.java
                        HttpSocketAgent.java RawHttp.java URLSupport.java
  Log:
  updated to use Log() ... why is this being committed again?

Revision  Changes    Path
1.3       +9 -8      java/webfunds/comms/BasicCommsManager.java

Index: BasicCommsManager.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/comms/BasicCommsManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- BasicCommsManager.java	2001/04/08 19:15:07	1.2
+++ BasicCommsManager.java	2001/04/12 05:07:50	1.3
@@ -16,33 +16,34 @@
 import java.net.Socket;
 import java.net.SocketException;
 
+import webfunds.util.Log;
+
 import webfunds.utils.Diagnostics;
 
 /**
  * A CommsManager that can return SingleRequestors.
  *
- * @version $Id: BasicCommsManager.java,v 1.2 2001/04/08 19:15:07 iang Exp $
+ * @version $Id: BasicCommsManager.java,v 1.3 2001/04/12 05:07:50 iang Exp $
  */
 public class BasicCommsManager
     implements CommsManager, Diagnostics
 {
     // mixing these classes is a bit non-OO.  But, it seems many need both.
     // another option would be to extend from Debug.
-    protected PrintWriter bug = null;
-    protected String      fix = "        Bcw- ";
+    private final static String      TAB = "               ";
+    protected String                 fix = TAB + "Bcw- ";
+    protected PrintWriter            bug = null;
     public void logmsg(String s)  { if (bug != null) bug.println(fix + s); }
     public PrintWriter getDebug() { return bug ; }
-    // hmm, no autoflush.
-    public PrintWriter err()
-    { return (bug == null) ? new PrintWriter(System.err, true) : bug ; }
-            
+    public PrintWriter err() { return (bug == null) ? new Log() : bug ; }
+
 
 
     /**
      * Create a new BasicCommsManager object.
      *
      */
-    public BasicCommsManager(PrintWriter bug)
+    public BasicCommsManager(Log bug)
     {
         this.bug = bug;
     }



1.23      +10 -5     java/webfunds/comms/HttpAgent.java

Index: HttpAgent.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/comms/HttpAgent.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- HttpAgent.java	2001/03/20 23:10:09	1.22
+++ HttpAgent.java	2001/04/12 05:07:50	1.23
@@ -1,5 +1,5 @@
 /*
- * $Id: HttpAgent.java,v 1.22 2001/03/20 23:10:09 iang Exp $
+ * $Id: HttpAgent.java,v 1.23 2001/04/12 05:07:50 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -9,6 +9,7 @@
 import java.io.*;
 import java.net.*;
 
+import webfunds.util.Log;
 import webfunds.util.Panic;
 
 /**
@@ -22,16 +23,20 @@
      */
     protected URL url;
 
-    transient protected PrintWriter pw;
+    transient protected Log pw;
 
+    protected final static String TAB = "           ";
+    protected String logfix = TAB + "a-";
+
+
     /**
      * Create a new HttpAgent object.
      *
      * @param url the http location where requests are sent
      */
-    public HttpAgent(URL url, PrintWriter bug)
+    public HttpAgent(URL url, Log bug)
     {
-        debug(bug, "       a= ");
+        debug(bug, logfix);
         this.url = url;
     }
 
@@ -126,7 +131,7 @@
     public String toString()
     {
         String s = "HttpAgent:";
-        s += "  Location: "+url;
+        s += " Loc: "+url;
         return s;
     }
 }



1.4       +6 -7      java/webfunds/comms/HttpSocketAgent.java

Index: HttpSocketAgent.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/comms/HttpSocketAgent.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- HttpSocketAgent.java	2001/04/08 19:15:07	1.3
+++ HttpSocketAgent.java	2001/04/12 05:07:50	1.4
@@ -1,12 +1,11 @@
 /*
- * $Id: HttpSocketAgent.java,v 1.3 2001/04/08 19:15:07 iang Exp $
+ * $Id: HttpSocketAgent.java,v 1.4 2001/04/12 05:07:50 iang Exp $
  *
  * Copyright (c) 1995-2001 Systemics Inc on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
  */
 package webfunds.comms;
 
-import java.io.PrintWriter;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.ByteArrayInputStream;
@@ -14,6 +13,7 @@
 
 import java.net.URL;
 
+import webfunds.util.Log;
 import webfunds.util.Panic;
 
 /**
@@ -28,14 +28,14 @@
     protected URL url;
     CommsManager comms = null;
 
-    transient protected PrintWriter pw;
+    transient protected Log pw;
 
     /**
      * Create a new HttpSocketAgent object.
      *
      * @param url the http location where requests are sent
      */
-    public HttpSocketAgent(URL url, PrintWriter bug)
+    public HttpSocketAgent(URL url, Log bug)
     {
         debug(bug, "             a= ");
         this.url = url;
@@ -47,7 +47,7 @@
      *
      * @param url the http location where requests are sent
      */
-    public HttpSocketAgent(URL url, CommsManager comms, PrintWriter bug)
+    public HttpSocketAgent(URL url, CommsManager comms, Log bug)
     {
         debug(bug, "             a= ");
         this.url = url;
@@ -358,8 +358,7 @@
 
     public String toString()
     {
-        String s = "HttpSocketAgent:";
-        s += "  Location: "+url;
+        String s = "HttpSocketAgent: " + url;
         return s;
     }
 }



1.11      +17 -2     java/webfunds/comms/RawHttp.java

Index: RawHttp.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/comms/RawHttp.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- RawHttp.java	2001/04/08 19:14:24	1.10
+++ RawHttp.java	2001/04/12 05:07:50	1.11
@@ -1,5 +1,5 @@
 /*
- * $Id: RawHttp.java,v 1.10 2001/04/08 19:14:24 iang Exp $
+ * $Id: RawHttp.java,v 1.11 2001/04/12 05:07:50 iang Exp $
  *
  * Copyright (c) 2000 Systemics Inc on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -9,6 +9,8 @@
 import java.io.*;
 import java.net.*;
 
+import webfunds.util.Log;
+
 import webfunds.utils.Debug;
 
 /**
@@ -28,9 +30,22 @@
      *
      * @param url the http location where requests are sent
      */
-    public RawHttp(URL url, PrintWriter bug)
+    public RawHttp(URL url, Log bug)
     {
         debug(bug, "       a= ");
+        this.url = url;
+    }
+
+    /**
+     *  XXX: deprecated
+     */
+    public RawHttp(URL url, PrintWriter bug)
+    {
+        if (bug instanceof Log)
+            debug(bug, "       a= ");
+        else
+            debug(new Log(bug), "       a= ");
+
         this.url = url;
     }
 



1.2       +6 -5      java/webfunds/comms/URLSupport.java

Index: URLSupport.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/comms/URLSupport.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- URLSupport.java	2001/04/08 19:15:30	1.1
+++ URLSupport.java	2001/04/12 05:07:50	1.2
@@ -5,15 +5,16 @@
 package webfunds.comms;
 
 import java.util.Vector;
-import java.io.PrintWriter;
 
 import java.net.URL;
 import java.net.MalformedURLException;
 
+import webfunds.util.Log;
+
 /**
  * Do some basic URL things.
  *
- * @version $Id: URLSupport.java,v 1.1 2001/04/08 19:15:30 iang Exp $
+ * @version $Id: URLSupport.java,v 1.2 2001/04/12 05:07:50 iang Exp $
  */
 public class URLSupport
 {
@@ -24,7 +25,7 @@
      *  Ignores malformed ones.
      *  Always returns an array.
      */
-    public static URL[] convertToURLs(String[] stringURLs, PrintWriter bug)
+    public static URL[] convertToURLs(String[] stringURLs, Log bug)
     {
         Vector v = new Vector();
  
@@ -39,8 +40,8 @@
                 continue ;
             }
             v.addElement(url);
-            if (bug != null)
-                bug.println("ok " + stringURLs[i]);
+            // if (bug != null)
+            //     bug.println("ok " + stringURLs[i]);
         }
        
         URL[] urls = new URL[v.size()];