james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r721922 - in /james/mpt/trunk: antlib/src/main/java/org/apache/james/mpt/ant/ main/src/main/java/org/apache/james/mpt/
Date Sun, 30 Nov 2008 23:00:46 GMT
Author: rdonkin
Date: Sun Nov 30 15:00:46 2008
New Revision: 721922

URL: http://svn.apache.org/viewvc?rev=721922&view=rev
Log:
Add more finely grained monitoring

Modified:
    james/mpt/trunk/antlib/src/main/java/org/apache/james/mpt/ant/MailProtocolTestTask.java
    james/mpt/trunk/main/src/main/java/org/apache/james/mpt/ExternalSession.java
    james/mpt/trunk/main/src/main/java/org/apache/james/mpt/Monitor.java
    james/mpt/trunk/main/src/main/java/org/apache/james/mpt/NullMonitor.java
    james/mpt/trunk/main/src/main/java/org/apache/james/mpt/SystemLoggingMonitor.java

Modified: james/mpt/trunk/antlib/src/main/java/org/apache/james/mpt/ant/MailProtocolTestTask.java
URL: http://svn.apache.org/viewvc/james/mpt/trunk/antlib/src/main/java/org/apache/james/mpt/ant/MailProtocolTestTask.java?rev=721922&r1=721921&r2=721922&view=diff
==============================================================================
--- james/mpt/trunk/antlib/src/main/java/org/apache/james/mpt/ant/MailProtocolTestTask.java
(original)
+++ james/mpt/trunk/antlib/src/main/java/org/apache/james/mpt/ant/MailProtocolTestTask.java
Sun Nov 30 15:00:46 2008
@@ -352,4 +352,11 @@
     public void note(String message) {
         log(message, Project.MSG_DEBUG);
     }
+
+    public void debug(char character) {
+    }
+
+    public void debug(String message) {
+        log(message, Project.MSG_DEBUG);
+    }
 }

Modified: james/mpt/trunk/main/src/main/java/org/apache/james/mpt/ExternalSession.java
URL: http://svn.apache.org/viewvc/james/mpt/trunk/main/src/main/java/org/apache/james/mpt/ExternalSession.java?rev=721922&r1=721921&r2=721922&view=diff
==============================================================================
--- james/mpt/trunk/main/src/main/java/org/apache/james/mpt/ExternalSession.java (original)
+++ james/mpt/trunk/main/src/main/java/org/apache/james/mpt/ExternalSession.java Sun Nov 30
15:00:46 2008
@@ -40,8 +40,12 @@
     private boolean first = true;
 
     private final String shabang;
-
+    
     public ExternalSession(final SocketChannel socket, final Monitor monitor, String shabang)
{
+        this(socket, monitor, shabang, false);
+    }
+
+    public ExternalSession(final SocketChannel socket, final Monitor monitor, String shabang,
boolean debug) {
         super();
         this.socket = socket;
         this.monitor = monitor;
@@ -68,12 +72,14 @@
     }
 
     private void readlineInto(StringBuffer buffer) throws Exception {
+        monitor.debug("[Reading line]");
         while (socket.read(readBuffer) == 0)
             ;
         readBuffer.flip();
         while (readOneMore(buffer))
             ;
         readBuffer.compact();
+        monitor.debug("[Done]");
     }
 
     private boolean readOneMore(StringBuffer buffer) throws Exception {
@@ -83,8 +89,10 @@
             if (next == '\n') {
                 result = false;
             } else if (next == '\r') {
+                monitor.debug('\r');
                 result = true;
             } else {
+                monitor.debug(next);
                 buffer.append(next);
                 result = true;
             }
@@ -110,6 +118,7 @@
 
     public void writeLine(String line) throws Exception {
         monitor.note("-> " + line);
+        monitor.debug("[Writing line]");
         ByteBuffer writeBuffer = ascii.encode(line);
         while (writeBuffer.hasRemaining()) {
             socket.write(writeBuffer);
@@ -118,6 +127,7 @@
         while (lineEndBuffer.hasRemaining()) {
             socket.write(lineEndBuffer);
         }
+        monitor.debug("[Done]");
     }
 
     /**

Modified: james/mpt/trunk/main/src/main/java/org/apache/james/mpt/Monitor.java
URL: http://svn.apache.org/viewvc/james/mpt/trunk/main/src/main/java/org/apache/james/mpt/Monitor.java?rev=721922&r1=721921&r2=721922&view=diff
==============================================================================
--- james/mpt/trunk/main/src/main/java/org/apache/james/mpt/Monitor.java (original)
+++ james/mpt/trunk/main/src/main/java/org/apache/james/mpt/Monitor.java Sun Nov 30 15:00:46
2008
@@ -25,4 +25,6 @@
  */
 public interface Monitor {
     void note(String message);
+    void debug(char character);
+    void debug(String message);
 }
\ No newline at end of file

Modified: james/mpt/trunk/main/src/main/java/org/apache/james/mpt/NullMonitor.java
URL: http://svn.apache.org/viewvc/james/mpt/trunk/main/src/main/java/org/apache/james/mpt/NullMonitor.java?rev=721922&r1=721921&r2=721922&view=diff
==============================================================================
--- james/mpt/trunk/main/src/main/java/org/apache/james/mpt/NullMonitor.java (original)
+++ james/mpt/trunk/main/src/main/java/org/apache/james/mpt/NullMonitor.java Sun Nov 30 15:00:46
2008
@@ -26,4 +26,10 @@
 
     public void note(String message) {
     }
+
+    public void debug(char character) {
+    }
+
+    public void debug(String messsage) {
+    }
 }

Modified: james/mpt/trunk/main/src/main/java/org/apache/james/mpt/SystemLoggingMonitor.java
URL: http://svn.apache.org/viewvc/james/mpt/trunk/main/src/main/java/org/apache/james/mpt/SystemLoggingMonitor.java?rev=721922&r1=721921&r2=721922&view=diff
==============================================================================
--- james/mpt/trunk/main/src/main/java/org/apache/james/mpt/SystemLoggingMonitor.java (original)
+++ james/mpt/trunk/main/src/main/java/org/apache/james/mpt/SystemLoggingMonitor.java Sun
Nov 30 15:00:46 2008
@@ -24,8 +24,28 @@
  */
 public final class SystemLoggingMonitor implements Monitor {
 
+    private boolean verbose = false;
+    
+    
+    public boolean isVerbose() {
+        return verbose;
+    }
+
+    public void setVerbose(boolean verbose) {
+        this.verbose = verbose;
+    }
+
     public void note(String message) {
         System.out.println(message);
     }
 
+    public void debug(char character) {
+        System.out.print(character);
+    }
+
+    public void debug(String message) {
+       System.out.println(message);
+    }
+
+    
 }
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message