Java Code Examples for org.eclipse.aether.transfer.TransferEvent#getRequestType()

The following examples show how to use org.eclipse.aether.transfer.TransferEvent#getRequestType() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConsoleTransferListener.java    From qpid-broker-j with Apache License 2.0 6 votes vote down vote up
@Override
public void transferSucceeded(TransferEvent event)
{
    transferCompleted(event);

    TransferResource resource = 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() - resource.getTransferStartTime();
        if (duration > 0)
        {
            long bytes = contentLength - resource.getResumeOffset();
            DecimalFormat format = new DecimalFormat("0.0", new DecimalFormatSymbols(Locale.ENGLISH));
            double kbPerSec = (bytes / 1024.0) / (duration / 1000.0);
            throughput = " at " + format.format(kbPerSec) + " KB/sec";
        }

        _out.println(type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len
                     + throughput + ")");
    }
}
 
Example 2
Source File: LoggingTransferListener.java    From maven-repository-tools with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void transferSucceeded( TransferEvent event )
{
    transferCompleted( event );

    TransferResource resource = 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() - resource.getTransferStartTime();
        if ( duration > 0 )
        {
            long bytes = contentLength - resource.getResumeOffset();
            DecimalFormat format = new DecimalFormat( "0.0", new DecimalFormatSymbols( Locale.ENGLISH ) );
            double kbPerSec = ( bytes / 1024.0 ) / ( duration / 1000.0 );
            throughput = " at " + format.format( kbPerSec ) + " KB/sec";
        }

        logger.info( type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len
            + throughput + ")" );
    }
}
 
Example 3
Source File: MavenUtil.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public void transferSucceeded(TransferEvent event) {
    transferCompleted(event);

    TransferResource resource = 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() - resource.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";
        }

        log.debug(type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len + throughput
                + ")");
    }
}
 
Example 4
Source File: ConsoleTransferListener.java    From jenkins-build-monitor-plugin with MIT License 6 votes vote down vote up
@Override
public void transferSucceeded(TransferEvent event) {
    transferCompleted(event);

    TransferResource resource = 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() - resource.getTransferStartTime();
        if (duration > 0) {
            long bytes = contentLength - resource.getResumeOffset();
            DecimalFormat format = new DecimalFormat("0.0", new DecimalFormatSymbols(Locale.ENGLISH));
            double kbPerSec = (bytes / 1024.0) / (duration / 1000.0);
            throughput = " at " + format.format(kbPerSec) + " KB/sec";
        }

        out.println(type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len
                + throughput + ")");
    }
}
 
Example 5
Source File: ConsoleTransferListener.java    From BIMserver with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public void transferSucceeded(TransferEvent event) {
	transferCompleted(event);

	TransferResource resource = 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() - resource.getTransferStartTime();
		if (duration > 0) {
			long bytes = contentLength - resource.getResumeOffset();
			DecimalFormat format = new DecimalFormat("0.0", new DecimalFormatSymbols(Locale.ENGLISH));
			double kbPerSec = (bytes / 1024.0) / (duration / 1000.0);
			throughput = " at " + format.format(kbPerSec) + " KB/sec";
		}

		out.println(type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len + throughput + ")");
	}
}
 
Example 6
Source File: LogTransferListener.java    From furnace with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void transferSucceeded(TransferEvent event)
{
   transferCompleted(event);
   TransferResource resource = 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() - resource.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 + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len
               + throughput + ")");
   }
}
 
Example 7
Source File: JULMavenTransferListener.java    From furnace with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void transferSucceeded(TransferEvent event)
{
   transferCompleted(event);
   TransferResource resource = 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() - resource.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.info(type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len
               + throughput + ")");
   }
}
 
Example 8
Source File: ConsoleTransferListener.java    From qpid-broker-j with Apache License 2.0 5 votes vote down vote up
@Override
public void transferInitiated(TransferEvent event)
{
    String message = event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploading" : "Downloading";

    _out.println(message + ": " + event.getResource().getRepositoryUrl() + event.getResource()
                                                                                .getResourceName());
}
 
Example 9
Source File: LoggingTransferListener.java    From maven-repository-tools with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void transferInitiated( TransferEvent event )
{
    String message = event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploading" : "Downloading";

    logger.info( message + ": " + event.getResource().getRepositoryUrl() + event.getResource().getResourceName() );
}
 
Example 10
Source File: LogTransferListener.java    From furnace with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void transferInitiated(TransferEvent event)
{
   String message = event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploading" : "Downloading";

   out.println(message + ": " + event.getResource().getRepositoryUrl() + event.getResource().getResourceName());
}
 
Example 11
Source File: JULMavenTransferListener.java    From furnace with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void transferInitiated(TransferEvent event)
{
   String message = event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploading" : "Downloading";

   out.info(message + ": " + event.getResource().getRepositoryUrl() + event.getResource().getResourceName());
}
 
Example 12
Source File: MavenUtil.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void transferInitiated(TransferEvent event) {
    String message = event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploading" : "Downloading";

    log.debug(message + ": " + event.getResource().getRepositoryUrl() + event.getResource().getResourceName());
}
 
Example 13
Source File: ConsoleTransferListener.java    From jenkins-build-monitor-plugin with MIT License 4 votes vote down vote up
@Override
public void transferInitiated(TransferEvent event) {
    String message = event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploading" : "Downloading";

    out.println(message + ": " + event.getResource().getRepositoryUrl() + event.getResource().getResourceName());
}
 
Example 14
Source File: ConsoleTransferListener.java    From BIMserver with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public void transferInitiated(TransferEvent event) {
	String message = event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploading" : "Downloading";

	out.println(message + ": " + event.getResource().getRepositoryUrl() + event.getResource().getResourceName());
}