out.println( message + ": " + event.getResource().getRepositoryUrl() + event.getResource().getResourceName() );
}
public void transferSucceeded( TransferEvent event )
{
TransferResource artifact = event.getResource();
long contentLength = event.getTransferredBytes();
if ( contentLength >= 0 )
{
String type = ( event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploaded" : "Downloaded" );
String len = contentLength >= 1024 ? toKB( contentLength ) + " KB" : contentLength + " B";
String throughput = "";
long duration = System.currentTimeMillis() - artifact.getTransferStartTime();
if ( duration > 0 )
{
DecimalFormat format = new DecimalFormat( "0.0", new DecimalFormatSymbols( Locale.ENGLISH ) );
double kbPerSec = ( contentLength / 1024.0 ) / ( duration / 1000.0 );
throughput = " at " + format.format( kbPerSec ) + " KB/sec";
}
out.println( type + ": " + artifact.getRepositoryUrl() + artifact.getResourceName() + " (" + len
+ throughput + ")" );
}
}