• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java TransferEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.maven.wagon.events.TransferEvent的典型用法代码示例。如果您正苦于以下问题:Java TransferEvent类的具体用法?Java TransferEvent怎么用?Java TransferEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TransferEvent类属于org.apache.maven.wagon.events包,在下文中一共展示了TransferEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: get

import org.apache.maven.wagon.events.TransferEvent; //导入依赖的package包/类
@Override
public final void get(String resourceName, File destination) throws TransferFailedException,
        ResourceDoesNotExistException, AuthorizationException {
    Resource resource = new Resource(resourceName);
    this.transferListenerSupport.fireTransferInitiated(resource, TransferEvent.REQUEST_GET);
    this.transferListenerSupport.fireTransferStarted(resource, TransferEvent.REQUEST_GET);

    try {
        getResource(resourceName, destination, new StandardTransferProgress(resource, TransferEvent.REQUEST_GET,
                this.transferListenerSupport));
        this.transferListenerSupport.fireTransferCompleted(resource, TransferEvent.REQUEST_GET);
    } catch (TransferFailedException | ResourceDoesNotExistException | AuthorizationException e) {
        this.transferListenerSupport.fireTransferError(resource, TransferEvent.REQUEST_GET, e);
        throw e;
    }
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:17,代码来源:AbstractWagon.java


示例2: getIfNewer

import org.apache.maven.wagon.events.TransferEvent; //导入依赖的package包/类
@Override
public final boolean getIfNewer(String resourceName, File destination, long timestamp)
        throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException {
    Resource resource = new Resource(resourceName);
    try {
        if (isRemoteResourceNewer(resourceName, timestamp)) {
            get(resourceName, destination);
            return true;
        }

        return false;
    } catch (TransferFailedException | ResourceDoesNotExistException | AuthorizationException e) {
        this.transferListenerSupport.fireTransferError(resource, TransferEvent.REQUEST_GET, e);
        throw e;
    }
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:17,代码来源:AbstractWagon.java


示例3: put

import org.apache.maven.wagon.events.TransferEvent; //导入依赖的package包/类
@Override
public final void put(File source, String destination) throws TransferFailedException,
        ResourceDoesNotExistException, AuthorizationException {
    Resource resource = new Resource(destination);
    this.transferListenerSupport.fireTransferInitiated(resource, TransferEvent.REQUEST_PUT);
    this.transferListenerSupport.fireTransferStarted(resource, TransferEvent.REQUEST_PUT);

    try {
        putResource(source, destination, new StandardTransferProgress(resource, TransferEvent.REQUEST_PUT,
                this.transferListenerSupport));
        this.transferListenerSupport.fireTransferCompleted(resource, TransferEvent.REQUEST_PUT);
    } catch (TransferFailedException | ResourceDoesNotExistException | AuthorizationException e) {
        this.transferListenerSupport.fireTransferError(resource, TransferEvent.REQUEST_PUT, e);
        throw e;
    }
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:17,代码来源:AbstractWagon.java


示例4: getTransferFailedException

import org.apache.maven.wagon.events.TransferEvent; //导入依赖的package包/类
@Test
public void getTransferFailedException() throws ResourceDoesNotExistException, AuthorizationException,
        TransferFailedException {
    TransferFailedException exception = new TransferFailedException("");
    doThrow(exception).when(this.wagon).getResource(eq("foo"), eq(new File("bar")), any(TransferProgress.class));

    try {
        this.wagon.get("foo", new File("bar"));
        fail();
    } catch (TransferFailedException e) {
        verify(this.transferListenerSupport).fireTransferInitiated(new Resource("foo"), TransferEvent.REQUEST_GET);
        verify(this.transferListenerSupport).fireTransferStarted(new Resource("foo"), TransferEvent.REQUEST_GET);
        verify(this.transferListenerSupport).fireTransferError(new Resource("foo"), TransferEvent.REQUEST_GET,
                exception);
    }
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:17,代码来源:AbstractWagonTest.java


示例5: getResourceDoesNotExistException

import org.apache.maven.wagon.events.TransferEvent; //导入依赖的package包/类
@Test
public void getResourceDoesNotExistException() throws TransferFailedException, ResourceDoesNotExistException,
        AuthorizationException {
    ResourceDoesNotExistException exception = new ResourceDoesNotExistException("");
    doThrow(exception).when(this.wagon).getResource(eq("foo"), eq(new File("bar")), any(TransferProgress.class));

    try {
        this.wagon.get("foo", new File("bar"));
        fail();
    } catch (ResourceDoesNotExistException e) {
        verify(this.transferListenerSupport).fireTransferInitiated(new Resource("foo"), TransferEvent.REQUEST_GET);
        verify(this.transferListenerSupport).fireTransferStarted(new Resource("foo"), TransferEvent.REQUEST_GET);
        verify(this.transferListenerSupport).fireTransferError(new Resource("foo"), TransferEvent.REQUEST_GET,
                exception);
    }
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:17,代码来源:AbstractWagonTest.java


示例6: getAuthorizationException

import org.apache.maven.wagon.events.TransferEvent; //导入依赖的package包/类
@Test
public void getAuthorizationException() throws TransferFailedException, ResourceDoesNotExistException,
        AuthorizationException {
    AuthorizationException exception = new AuthorizationException("");
    doThrow(exception).when(this.wagon).getResource(eq("foo"), eq(new File("bar")), any(TransferProgress.class));

    try {
        this.wagon.get("foo", new File("bar"));
        fail();
    } catch (AuthorizationException e) {
        verify(this.transferListenerSupport).fireTransferInitiated(new Resource("foo"), TransferEvent.REQUEST_GET);
        verify(this.transferListenerSupport).fireTransferStarted(new Resource("foo"), TransferEvent.REQUEST_GET);
        verify(this.transferListenerSupport).fireTransferError(new Resource("foo"), TransferEvent.REQUEST_GET,
                exception);
    }
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:17,代码来源:AbstractWagonTest.java


示例7: putTransferFailedException

import org.apache.maven.wagon.events.TransferEvent; //导入依赖的package包/类
@Test
public void putTransferFailedException() throws TransferFailedException, ResourceDoesNotExistException,
        AuthorizationException {
    TransferFailedException exception = new TransferFailedException("");
    doThrow(exception).when(this.wagon).putResource(eq(new File("foo")), eq("bar"), any(TransferProgress.class));

    try {
        this.wagon.put(new File("foo"), "bar");
        fail();
    } catch (TransferFailedException e) {
        verify(this.transferListenerSupport).fireTransferInitiated(new Resource("bar"), TransferEvent.REQUEST_PUT);
        verify(this.transferListenerSupport).fireTransferStarted(new Resource("bar"), TransferEvent.REQUEST_PUT);
        verify(this.transferListenerSupport).fireTransferError(new Resource("bar"), TransferEvent.REQUEST_PUT,
                exception);
    }
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:17,代码来源:AbstractWagonTest.java


示例8: putResourceDoesNotExistException

import org.apache.maven.wagon.events.TransferEvent; //导入依赖的package包/类
@Test
public void putResourceDoesNotExistException() throws TransferFailedException, ResourceDoesNotExistException,
        AuthorizationException {
    ResourceDoesNotExistException exception = new ResourceDoesNotExistException("");
    doThrow(exception).when(this.wagon).putResource(eq(new File("foo")), eq("bar"), any(TransferProgress.class));

    try {
        this.wagon.put(new File("foo"), "bar");
        fail();
    } catch (ResourceDoesNotExistException e) {
        verify(this.transferListenerSupport).fireTransferInitiated(new Resource("bar"), TransferEvent.REQUEST_PUT);
        verify(this.transferListenerSupport).fireTransferStarted(new Resource("bar"), TransferEvent.REQUEST_PUT);
        verify(this.transferListenerSupport).fireTransferError(new Resource("bar"), TransferEvent.REQUEST_PUT,
                exception);
    }
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:17,代码来源:AbstractWagonTest.java


示例9: putAuthorizationException

import org.apache.maven.wagon.events.TransferEvent; //导入依赖的package包/类
@Test
public void putAuthorizationException() throws TransferFailedException, ResourceDoesNotExistException,
        AuthorizationException {
    AuthorizationException exception = new AuthorizationException("");
    doThrow(exception).when(this.wagon).putResource(eq(new File("foo")), eq("bar"), any(TransferProgress.class));

    try {
        this.wagon.put(new File("foo"), "bar");
        fail();
    } catch (AuthorizationException e) {
        verify(this.transferListenerSupport).fireTransferInitiated(new Resource("bar"), TransferEvent.REQUEST_PUT);
        verify(this.transferListenerSupport).fireTransferStarted(new Resource("bar"), TransferEvent.REQUEST_PUT);
        verify(this.transferListenerSupport).fireTransferError(new Resource("bar"), TransferEvent.REQUEST_PUT,
                exception);
    }
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:17,代码来源:AbstractWagonTest.java


示例10: putDirectory

import org.apache.maven.wagon.events.TransferEvent; //导入依赖的package包/类
@Test
public void putDirectory() throws IOException, TransferFailedException, ResourceDoesNotExistException,
        AuthorizationException {
    File directory = new File("target/test");
    directory.mkdirs();
    File file = new File(directory, "test.txt");
    file.createNewFile();

    this.wagon.putDirectory(directory, "foo");

    verify(this.transferListenerSupport).fireTransferInitiated(new Resource("foo/test.txt"),
            TransferEvent.REQUEST_PUT);
    verify(this.transferListenerSupport).fireTransferStarted(new Resource("foo/test.txt"),
            TransferEvent.REQUEST_PUT);
    verify(this.wagon).putResource(eq(new File("target/test/test.txt")), eq("foo/test.txt"),
            any(TransferProgress.class));
    verify(this.transferListenerSupport).fireTransferCompleted(new Resource("foo/test.txt"),
            TransferEvent.REQUEST_PUT);
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:20,代码来源:AbstractWagonTest.java


示例11: transferCompleted

import org.apache.maven.wagon.events.TransferEvent; //导入依赖的package包/类
public void transferCompleted(TransferEvent event) {
  try {
    MavenServerDownloadListener listener = Maven2ServerGlobals.getDownloadListener();
    if (listener != null) listener.artifactDownloaded(event.getLocalFile(), event.getResource().getName());
  }
  catch (RemoteException e) {
    throw new RuntimeRemoteException(e);
  }

  checkCanceled();

  String resourceName = event.getResource().getName();
  DownloadData data = myDownloads.remove(resourceName);
  data.finished = true;
  updateProgress(resourceName, data);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:TransferListenerAdapter.java


示例12: get

import org.apache.maven.wagon.events.TransferEvent; //导入依赖的package包/类
@Override
public void get(String resourceName, File destination)
		throws TransferFailedException, ResourceDoesNotExistException,
		AuthorizationException {
	Resource resource = new Resource(resourceName);
	fireGetInitiated(resource, destination);
	fireGetStarted(resource, destination);

	try {
		File remote = new File(checkoutDirectory, resourceName);
		if (remote.exists()){
			transfer(resource, new FileInputStream(remote), new FileOutputStream(destination), TransferEvent.REQUEST_GET);
		}
	} catch (Exception e) {
		fireTransferError(resource, e, TransferEvent.REQUEST_GET);
		throw new TransferFailedException("Unable to get file", e);
	}

	fireGetCompleted(resource, destination);
}
 
开发者ID:opoo,项目名称:opoopress,代码行数:21,代码来源:GitWagon.java


示例13: transferCompleted

import org.apache.maven.wagon.events.TransferEvent; //导入依赖的package包/类
public void transferCompleted( TransferEvent transferEvent )
{
    ArtifactTransferEvent event = wrap( transferEvent );

    Long transferred = null;
    synchronized ( transfers )
    {
        transferred = transfers.remove( transferEvent.getResource() );
    }
    if ( transferred != null )
    {
        event.setTransferredBytes( transferred.longValue() );
    }

    synchronized ( artifacts )
    {
        artifacts.remove( transferEvent.getResource() );
    }

    listener.transferCompleted( event );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:22,代码来源:TransferListenerAdapter.java


示例14: transferProgress

import org.apache.maven.wagon.events.TransferEvent; //导入依赖的package包/类
public void transferProgress( TransferEvent transferEvent, byte[] buffer, int length )
{
    Long transferred;
    synchronized ( transfers )
    {
        transferred = transfers.get( transferEvent.getResource() );
        if ( transferred == null )
        {
            transferred = Long.valueOf( length );
        }
        else
        {
            transferred = Long.valueOf( transferred.longValue() + length );
        }
        transfers.put( transferEvent.getResource(), transferred );
    }

    ArtifactTransferEvent event = wrap( transferEvent );
    event.setDataBuffer( buffer );
    event.setDataOffset( 0 );
    event.setDataLength( length );
    event.setTransferredBytes( transferred.longValue() );

    listener.transferProgress( event );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:26,代码来源:TransferListenerAdapter.java


示例15: transferStarted

import org.apache.maven.wagon.events.TransferEvent; //导入依赖的package包/类
public @Override void transferStarted(TransferEvent e) {
    checkCancel();
    long contentLength = e.getResource().getContentLength();
    LOG.log(Level.FINE, "contentLength: {0}", contentLength);
    // #189806: could be resumed due to FNFE in DefaultIndexUpdater (*.gz -> *.zip)
    this.units = contentLength / 1024;        
    handle.switchToDeterminate(100);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:RemoteIndexTransferListener.java


示例16: transferProgress

import org.apache.maven.wagon.events.TransferEvent; //导入依赖的package包/类
public @Override void transferProgress(TransferEvent e, byte[] buffer, int length) {
    checkCancel();
    LOG.log(Level.FINER, "progress: {0}", length);
    int work = length / 1024;
    if(units > 0) {
        lastunit += work;
        handle.progress(Math.min(100, (int)(((double) lastunit / units) * 100)));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:RemoteIndexTransferListener.java


示例17: transferInitiated

import org.apache.maven.wagon.events.TransferEvent; //导入依赖的package包/类
@Override
public void transferInitiated( TransferEvent transferEvent )
{
    startTime = System.currentTimeMillis();
    resourceName = transferEvent.getResource().getName();
    log.debug( "initiate transfer of {}", resourceName );
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:8,代码来源:DownloadRemoteIndexTask.java


示例18: transferStarted

import org.apache.maven.wagon.events.TransferEvent; //导入依赖的package包/类
@Override
public void transferStarted( TransferEvent transferEvent )
{
    this.totalLength = 0;
    resourceName = transferEvent.getResource().getName();
    log.info( "start transfer of {}", transferEvent.getResource().getName() );
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:8,代码来源:DownloadRemoteIndexTask.java


示例19: transferCompleted

import org.apache.maven.wagon.events.TransferEvent; //导入依赖的package包/类
@Override
public void transferCompleted( TransferEvent transferEvent )
{
    resourceName = transferEvent.getResource().getName();
    long endTime = System.currentTimeMillis();
    log.info( "end of transfer file {} {} kb: {}s", transferEvent.getResource().getName(),
              this.totalLength / 1024, ( endTime - startTime ) / 1000 );
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:9,代码来源:DownloadRemoteIndexTask.java


示例20: fireTransferInitiated

import org.apache.maven.wagon.events.TransferEvent; //导入依赖的package包/类
@Override
public void fireTransferInitiated(Resource resource, int requestType) {
    TransferEvent event = new TransferEvent(this.wagon, resource, TransferEvent.TRANSFER_INITIATED, requestType);
    for (TransferListener transferListener : this.transferListeners) {
        transferListener.transferInitiated(event);
    }
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:8,代码来源:StandardTransferListenerSupport.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Template类代码示例发布时间:2022-05-22
下一篇:
Java GPUImageKuwaharaFilter类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap