当前位置: 首页>>代码示例>>Java>>正文


Java TransferEvent.getResource方法代码示例

本文整理汇总了Java中org.sonatype.aether.transfer.TransferEvent.getResource方法的典型用法代码示例。如果您正苦于以下问题:Java TransferEvent.getResource方法的具体用法?Java TransferEvent.getResource怎么用?Java TransferEvent.getResource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.sonatype.aether.transfer.TransferEvent的用法示例。


在下文中一共展示了TransferEvent.getResource方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: transferProgressed

import org.sonatype.aether.transfer.TransferEvent; //导入方法依赖的package包/类
@Override
public void transferProgressed(TransferEvent event) {
  TransferResource resource = event.getResource();
  downloads.put(resource, Long.valueOf(event.getTransferredBytes()));

  StringBuilder buffer = new StringBuilder(64);

  for (Map.Entry<TransferResource, Long> entry : downloads.entrySet()) {
    long total = entry.getKey().getContentLength();
    long complete = entry.getValue().longValue();

    buffer.append(getStatus(complete, total)).append("  ");
  }

  int pad = lastLength - buffer.length();
  lastLength = buffer.length();
  pad(buffer, pad);
  buffer.append('\r');

  logger.info(buffer.toString());
}
 
开发者ID:lorthos,项目名称:incubator-zeppelin-druid,代码行数:22,代码来源:TransferListener.java

示例2: transferSucceeded

import org.sonatype.aether.transfer.TransferEvent; //导入方法依赖的package包/类
@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";
    }

    logger.info(type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " ("
        + len + throughput + ")");
  }
}
 
开发者ID:lorthos,项目名称:incubator-zeppelin-druid,代码行数:24,代码来源:TransferListener.java

示例3: transferProgressed

import org.sonatype.aether.transfer.TransferEvent; //导入方法依赖的package包/类
@Override
public void transferProgressed(TransferEvent event) {
  TransferResource resource = event.getResource();
  downloads.put(resource, event.getTransferredBytes());

  StringBuilder buffer = new StringBuilder(64);

  for (Map.Entry<TransferResource, Long> entry : downloads.entrySet()) {
    long total = entry.getKey().getContentLength();
    long complete = entry.getValue();

    buffer.append(getStatus(complete, total)).append("  ");
  }

  int pad = lastLength - buffer.length();
  lastLength = buffer.length();
  pad(buffer, pad);
  buffer.append('\r');

  logger.info(buffer.toString());
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:22,代码来源:TransferListener.java

示例4: transferSucceeded

import org.sonatype.aether.transfer.TransferEvent; //导入方法依赖的package包/类
@Override
public void transferSucceeded(TransferEvent 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";
        }

        logger.debug(type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len + throughput + ")");
    }
}
 
开发者ID:airlift,项目名称:resolver,代码行数:21,代码来源:ConsoleTransferListener.java

示例5: transferProgressed

import org.sonatype.aether.transfer.TransferEvent; //导入方法依赖的package包/类
@Override
public void transferProgressed( TransferEvent event )
{
	TransferResource resource = event.getResource();
	downloads.put( resource, Long.valueOf( event.getTransferredBytes() ) );

	StringBuilder buffer = new StringBuilder( 64 );

	for ( Map.Entry<TransferResource, Long> entry : downloads.entrySet() )
	{
		long total = entry.getKey().getContentLength();
		long complete = entry.getValue().longValue();

		buffer.append( getStatus( complete, total ) ).append( " " );
	}

	int pad = lastLength - buffer.length();
	lastLength = buffer.length();
	pad( buffer, pad );

	log.debug(buffer);
}
 
开发者ID:bnavetta,项目名称:tycho-gen,代码行数:23,代码来源:LoggingTransferListener.java

示例6: transferSucceeded

import org.sonatype.aether.transfer.TransferEvent; //导入方法依赖的package包/类
@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.info("{}: {}{} ({} {})", type, resource.getRepositoryUrl(), resource.getResourceName(), len, throughput);
	}
}
 
开发者ID:bnavetta,项目名称:tycho-gen,代码行数:25,代码来源:LoggingTransferListener.java

示例7: transferProgressed

import org.sonatype.aether.transfer.TransferEvent; //导入方法依赖的package包/类
@Override
public void transferProgressed(TransferEvent event)
{
  TransferResource resource = event.getResource();
  downloads.put(resource, Long.valueOf(event.getTransferredBytes()));

  StringBuilder buffer = new StringBuilder(64);

  for (Map.Entry<TransferResource, Long> entry : downloads.entrySet())
  {
    long total = entry.getKey().getContentLength();
    long complete = entry.getValue().longValue();

    buffer.append(getStatus(complete, total)).append("  ");
  }

  int pad = lastLength - buffer.length();
  lastLength = buffer.length();
  pad(buffer, pad);
  buffer.append('\r');

  log.trace(buffer);
}
 
开发者ID:terraframe,项目名称:Runway-SDK,代码行数:24,代码来源:TransferListener.java

示例8: transferSucceeded

import org.sonatype.aether.transfer.TransferEvent; //导入方法依赖的package包/类
@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.info(type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len
        + throughput + ")");
  }
}
 
开发者ID:terraframe,项目名称:Runway-SDK,代码行数:27,代码来源:TransferListener.java

示例9: transferSucceeded

import org.sonatype.aether.transfer.TransferEvent; //导入方法依赖的package包/类
@Override
public void transferSucceeded( TransferEvent 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 + ")" );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:24,代码来源:AbstractMavenTransferListener.java

示例10: transferSucceeded

import org.sonatype.aether.transfer.TransferEvent; //导入方法依赖的package包/类
@Override
public void transferSucceeded( TransferEvent 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 + ")" );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:24,代码来源:Slf4jMavenTransferListener.java

示例11: transferProgressed

import org.sonatype.aether.transfer.TransferEvent; //导入方法依赖的package包/类
@Override
public void transferProgressed( TransferEvent event )
{
    TransferResource resource = event.getResource();
    downloads.put( resource, Long.valueOf( event.getTransferredBytes() ) );

    StringBuilder buffer = new StringBuilder( 64 );

    for ( Map.Entry<TransferResource, Long> entry : downloads.entrySet() )
    {
        long total = entry.getKey().getContentLength();
        long complete = entry.getValue().longValue();

        buffer.append( getStatus( complete, total ) ).append( "  " );
    }

    int pad = lastLength - buffer.length();
    lastLength = buffer.length();
    pad( buffer, pad );
    buffer.append( '\r' );

    print( "transferProgressed", buffer.toString() );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:24,代码来源:ConsoleTransferListener.java

示例12: transferSucceeded

import org.sonatype.aether.transfer.TransferEvent; //导入方法依赖的package包/类
@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";
        }

        println( "transferSucceeded", type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " ("
            + len + throughput + ")" );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:26,代码来源:ConsoleTransferListener.java

示例13: transferProgressed

import org.sonatype.aether.transfer.TransferEvent; //导入方法依赖的package包/类
@Override
public void transferProgressed( TransferEvent event )
{
    TransferResource resource = event.getResource();
    downloads.put( resource, Long.valueOf( event.getTransferredBytes() ) );

    StringBuilder buffer = new StringBuilder( 64 );

    for ( Map.Entry<TransferResource, Long> entry : downloads.entrySet() )
    {
        long total = entry.getKey().getContentLength();
        long complete = entry.getValue().longValue();

        buffer.append( getStatus( complete, total ) ).append( "  " );
    }

    int pad = lastLength - buffer.length();
    lastLength = buffer.length();
    pad( buffer, pad );
    buffer.append( '\r' );

    out.print( buffer );
}
 
开发者ID:cloudbees,项目名称:bees-maven-components,代码行数:24,代码来源:ConsoleTransferListener.java

示例14: transferSucceeded

import org.sonatype.aether.transfer.TransferEvent; //导入方法依赖的package包/类
@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 + ")" );
    }
}
 
开发者ID:cloudbees,项目名称:bees-maven-components,代码行数:26,代码来源:ConsoleTransferListener.java

示例15: transferProgressed

import org.sonatype.aether.transfer.TransferEvent; //导入方法依赖的package包/类
@Override
public void transferProgressed(TransferEvent event) throws TransferCancelledException {
  checkCanceled();

  TransferResource r = event.getResource();

  long totalLength = r.getContentLength();

  String sizeInfo;
  if (totalLength <= 0) {
    sizeInfo = StringUtil.formatFileSize(event.getTransferredBytes()) + " / ?";
  } else {
    sizeInfo = StringUtil.formatFileSize(event.getTransferredBytes()) + " / " + StringUtil.formatFileSize(totalLength);
  }

  try {
    myIndicator.setText2(formatResourceName(event) + "  (" + sizeInfo + ')');
    if (totalLength <= 0) {
      myIndicator.setIndeterminate(true);
    }
    else {
      myIndicator.setIndeterminate(false);
      myIndicator.setFraction((double)event.getTransferredBytes() / totalLength);
    }
  }
  catch (RemoteException e) {
    throw new RuntimeRemoteException(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:Maven30TransferListenerAdapter.java


注:本文中的org.sonatype.aether.transfer.TransferEvent.getResource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。