You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2008/05/29 07:14:21 UTC

svn commit: r661214 - /geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/monitor/ProgressSpinnerMonitor.java

Author: jdillon
Date: Wed May 28 22:14:21 2008
New Revision: 661214

URL: http://svn.apache.org/viewvc?rev=661214&view=rev
Log:
Use transferStarted to display status, since it seems like transferInitiated is not always called.

Modified:
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/monitor/ProgressSpinnerMonitor.java

Modified: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/monitor/ProgressSpinnerMonitor.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/monitor/ProgressSpinnerMonitor.java?rev=661214&r1=661213&r2=661214&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/monitor/ProgressSpinnerMonitor.java (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/monitor/ProgressSpinnerMonitor.java Wed May 28 22:14:21 2008
@@ -36,9 +36,9 @@
 {
     private static final String CARRIAGE_RETURN = "\r";
 
-    private IO io;
+    private final IO io;
 
-    private ProgressSpinner spinner = new ProgressSpinner();
+    private final ProgressSpinner spinner = new ProgressSpinner();
 
     private long complete;
 
@@ -63,6 +63,9 @@
         }
     }
 
+    /*
+    NOTE: Seems liked this is not always called, so use transferStarted to display the banner
+
     public void transferInitiated(final TransferEvent event) {
         assert event != null;
 
@@ -72,12 +75,42 @@
 
         spinner.reset();
 
-        String message = event.getRequestType() == REQUEST_PUT ? "Uploading" : "Downloading";
+        String type = event.getRequestType() == REQUEST_PUT ? "Uploading" : "Downloading";
         String url = event.getWagon().getRepository().getUrl();
 
-        println(message + ": " + url + "/" + event.getResource().getName());
+        String message = type + ": " + url + "/" + event.getResource().getName();
+
+        log.debug(message);
+
+        println(message);
     }
+    */
+
+    //
+    // TODO: May actually want to use a little timmer thread to make this spin more often for better user feedback
+    //       that we are still working, then use the event to update the message.  Or really, put the timer in
+    //       the spinner impl, and then just update the status message
+    //
     
+    public void transferStarted(final TransferEvent event) {
+        assert event != null;
+
+        super.transferStarted(event);
+
+        complete = 0;
+
+        spinner.reset();
+
+        String type = event.getRequestType() == REQUEST_PUT ? "Uploading" : "Downloading";
+        String url = event.getWagon().getRepository().getUrl();
+
+        String message = type + ": " + url + "/" + event.getResource().getName();
+
+        log.debug(message);
+
+        println(message);
+    }
+
     public void transferProgress(final TransferEvent event, final byte[] buffer, final int length) {
         assert event != null;
 
@@ -95,6 +128,8 @@
             message = complete + "/" + (total == UNKNOWN_LENGTH ? "?" : total + "b");
         }
 
+        log.debug(message);
+        
         print(spinner.spin(message));
     }
 }
\ No newline at end of file