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


Java ResourceDoesNotExistException类代码示例

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


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

示例1: get

import org.apache.maven.wagon.ResourceDoesNotExistException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public void get(String s, File file)
    throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
{
  if (LOG.isTraceEnabled()) {
    LOG.trace(String.format("Fetching [%s] to [%s]", s, file));
  }
  try {
    final Blob blob = getStorage().get(toBlobID(s));
    if (blob == null) {
      throw new ResourceDoesNotExistException(String.format("Not found [%s]", s));
    }
    get(blob, file);
  }
  catch (StorageException se) {
    throw translate(s, se);
  }
  catch (IOException e) {
    throw new TransferFailedException(String.format("Failed to write to file [%s]", file), e);
  }
}
 
开发者ID:drcrallen,项目名称:gswagon-maven-plugin,代码行数:24,代码来源:GSWagon.java

示例2: getIfNewer

import org.apache.maven.wagon.ResourceDoesNotExistException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public boolean getIfNewer(String s, File file, long ts)
    throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
{
  try {
    final Blob blob = getStorage().get(toBlobID(s));
    if (blob.getCreateTime() <= ts) {
      if (LOG.isTraceEnabled()) {
        LOG.trace(String.format("Not fetching, [%s] at [%s] is older than [%s]", s, blob.getCreateTime(), ts));
      }
      return false;
    }
    get(blob, file);
    return true;
  }
  catch (StorageException se) {
    throw translate(s, se);
  }
  catch (IOException ioe) {
    throw new TransferFailedException(String.format("Unable to write [%s]", file), ioe);
  }
}
 
开发者ID:drcrallen,项目名称:gswagon-maven-plugin,代码行数:25,代码来源:GSWagon.java

示例3: get

import org.apache.maven.wagon.ResourceDoesNotExistException; //导入依赖的package包/类
@Override
public void get( String s, File file )
    throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
{
    String sourceFile = getBasedir() + "/target/test-classes/" + s;

    try
    {
        FileUtils.copyFile( new File( sourceFile ), file );
        assert( file.exists() );
    }
    catch( IOException e )
    {
        throw new ResourceDoesNotExistException( e.getMessage() );            
    }
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:17,代码来源:MockWagon.java

示例4: get

import org.apache.maven.wagon.ResourceDoesNotExistException; //导入依赖的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

示例5: getIfNewer

import org.apache.maven.wagon.ResourceDoesNotExistException; //导入依赖的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

示例6: put

import org.apache.maven.wagon.ResourceDoesNotExistException; //导入依赖的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

示例7: getTransferFailedException

import org.apache.maven.wagon.ResourceDoesNotExistException; //导入依赖的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

示例8: getResourceDoesNotExistException

import org.apache.maven.wagon.ResourceDoesNotExistException; //导入依赖的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

示例9: getAuthorizationException

import org.apache.maven.wagon.ResourceDoesNotExistException; //导入依赖的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

示例10: putTransferFailedException

import org.apache.maven.wagon.ResourceDoesNotExistException; //导入依赖的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

示例11: putResourceDoesNotExistException

import org.apache.maven.wagon.ResourceDoesNotExistException; //导入依赖的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

示例12: putAuthorizationException

import org.apache.maven.wagon.ResourceDoesNotExistException; //导入依赖的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

示例13: putDirectory

import org.apache.maven.wagon.ResourceDoesNotExistException; //导入依赖的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

示例14: getArtifact

import org.apache.maven.wagon.ResourceDoesNotExistException; //导入依赖的package包/类
@Override
public void getArtifact(Artifact artifact, List remoteRepositories) throws TransferFailedException, ResourceDoesNotExistException {
  myInBatchResolve.set(Boolean.TRUE);
  try {
    if (!takeFromCache(artifact)) {
      try {
        super.getArtifact(artifact, remoteRepositories);
      }
      catch (WagonException ignore) {
      }
      cache(artifact);
      myUnresolvedCollector.collectAndSetResolved(artifact);
    }
  }
  finally {
    myInBatchResolve.set(Boolean.FALSE);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:CustomMaven3WagonManager.java

示例15: transferChecksum

import org.apache.maven.wagon.ResourceDoesNotExistException; //导入依赖的package包/类
/**
 *
 * @param wagon The wagon instance that should be connected.
 * @param remoteRepository The repository from where the checksum file should be retrieved
 * @param remotePath The remote path of the artifact (without extension)
 * @param resource The local artifact (without extension)
 * @param workingDir The working directory where the downloaded file should be placed to
 * @param ext The extension of th checksum file
 * @return The file where the data has been downloaded to.
 * @throws AuthorizationException
 * @throws TransferFailedException
 * @throws ResourceDoesNotExistException
 */
private Path transferChecksum( final Wagon wagon, final RemoteRepository remoteRepository,
                               final String remotePath, final Path resource,
                               final Path workingDir, final String ext )
    throws AuthorizationException, TransferFailedException, ResourceDoesNotExistException
{
    Path destFile = workingDir.resolve( resource.getFileName() + ext );
    String remoteChecksumPath = remotePath + ext;

    log.info( "Retrieving {} from {}", remoteChecksumPath, remoteRepository.getName() );

    wagon.get( addParameters( remoteChecksumPath, remoteRepository ), destFile.toFile() );

    log.debug( "Downloaded successfully." );

    return destFile;
}
 
开发者ID:apache,项目名称:archiva,代码行数:30,代码来源:RepositoryModelResolver.java


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