本文整理汇总了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);
}
}
示例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);
}
}
示例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() );
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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;
}