throw new ResourceDoesNotExistException( "Failure to resolve " + remotePath + " from " + repository.getUrl() + " was cached in the local repository. "
throw new ResourceDoesNotExistException( "Unable to download the artifact from any repository" );
throw new ResourceDoesNotExistException( "Downloaded file does not exist: " + temp );
private void provideUnpackedFile(File destination, File file) throws TransferFailedException, IOException, ResourceDoesNotExistException { if (file.exists()) { if (destination.exists() && !destination.delete()) { throw new TransferFailedException("cannot delete file " + destination.getAbsolutePath()); } Files.createLink(destination.toPath(), file.toPath()); } else { throw new ResourceDoesNotExistException("no compatible artifact found in nuget package"); } }
@Override protected boolean isRemoteResourceNewer(String resourceName, long timestamp) throws ResourceDoesNotExistException { try { Date lastModified = getObjectMetadata(resourceName).getLastModified(); return lastModified == null || lastModified.getTime() > timestamp; } catch (AmazonServiceException e) { throw new ResourceDoesNotExistException(String.format("'%s' does not exist", resourceName), e); } }
@Override protected boolean isRemoteResourceNewer(String resourceName, long timestamp) throws ResourceDoesNotExistException { try { Date lastModified = getObjectMetadata(resourceName).getLastModified(); return lastModified == null ? true : lastModified.getTime() > timestamp; } catch (AmazonServiceException e) { throw new ResourceDoesNotExistException(String.format("'%s' does not exist", resourceName), e); } }
@Override protected boolean isRemoteResourceNewer(String resourceName, long timestamp) throws ResourceDoesNotExistException { try { Date lastModified = getObjectMetadata(resourceName).getLastModified(); return lastModified == null || lastModified.getTime() > timestamp; } catch (AmazonServiceException e) { throw new ResourceDoesNotExistException(String.format("'%s' does not exist", resourceName), e); } }
public void getMd5Hash(Repository repository, NugetArtifact artifact, File destination) throws TransferFailedException, ResourceDoesNotExistException { if (!artifact.isNugetFile()) { throw new ResourceDoesNotExistException("hash for files extracted from nuget archive not supported."); } try (CloseableHttpClient client = HttpClients.createDefault()) { HttpHead headRequest = new HttpHead(repository.getUrl() + "/" + artifact.resourceString()); try (CloseableHttpResponse response = client.execute(headRequest)) { Header checkSum = response.getFirstHeader("Content-MD5"); if (checkSum == null) { throw new ResourceDoesNotExistException("Content-MD5 header not set"); } FileUtils.write(destination, checkSum.getValue(), StandardCharsets.ISO_8859_1); } } catch (IOException e) { throw new TransferFailedException(e.getMessage(), e); } } }
/** * {@inheritDoc} */ public void fillInputData(InputData inputData) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { log.debug("Invoked fillInputData()"); Resource resource = inputData.getResource(); File file = new File(git.workDir, resource.getName()); if (!file.exists()) { throw new ResourceDoesNotExistException("File: " + file + " does not exist"); } try { InputStream in = new BufferedInputStream(new FileInputStream(file)); inputData.setInputStream(in); resource.setContentLength(file.length()); resource.setLastModified(file.lastModified()); } catch (FileNotFoundException e) { throw new TransferFailedException("Could not read from file: " + file.getAbsolutePath(), e); } }
public void run( Wagon wagon ) throws Exception { String src = task.getLocation().toString(); if ( !wagon.resourceExists( src ) ) { throw new ResourceDoesNotExistException( "Could not find " + src + " in " + wagon.getRepository().getUrl() ); } }
@Override protected void getResource(String resourceName, File destination, TransferProgress transferProgress) throws TransferFailedException, ResourceDoesNotExistException { InputStream in = null; OutputStream out = null; try { S3Object s3Object = this.amazonS3.getObject(this.bucketName, getKey(resourceName)); in = s3Object.getObjectContent(); out = new TransferProgressFileOutputStream(destination, transferProgress); IoUtils.copy(in, out); } catch (AmazonServiceException e) { throw new ResourceDoesNotExistException(String.format("'%s' does not exist", resourceName), e); } catch (FileNotFoundException e) { throw new TransferFailedException(String.format("Cannot write file to '%s'", destination), e); } catch (IOException e) { throw new TransferFailedException(String.format("Cannot read from '%s' and write to '%s'", resourceName, destination), e); } finally { IoUtils.closeQuietly(in, out); } }
@Override protected void getResource(String resourceName, File destination, TransferProgress transferProgress) throws TransferFailedException, ResourceDoesNotExistException { InputStream in = null; OutputStream out = null; try { S3Object s3Object = this.amazonS3.getObject(this.bucketName, getKey(resourceName)); in = s3Object.getObjectContent(); out = new TransferProgressFileOutputStream(destination, transferProgress); IoUtils.copy(in, out); } catch (AmazonServiceException e) { throw new ResourceDoesNotExistException(String.format("'%s' does not exist", resourceName), e); } catch (FileNotFoundException e) { throw new TransferFailedException(String.format("Cannot write file to '%s'", destination), e); } catch (IOException e) { throw new TransferFailedException(String.format("Cannot read from '%s' and write to '%s'", resourceName, destination), e); } finally { IoUtils.closeQuietly(in, out); } }
@Override protected void getResource(String resourceName, File destination, TransferProgress transferProgress) throws TransferFailedException, ResourceDoesNotExistException { InputStream in = null; OutputStream out = null; try { S3Object s3Object = this.amazonS3.getObject(this.bucketName, getKey(resourceName)); in = s3Object.getObjectContent(); out = new TransferProgressFileOutputStream(destination, transferProgress); IoUtils.copy(in, out); } catch (AmazonServiceException e) { throw new ResourceDoesNotExistException(String.format("'%s' does not exist", resourceName), e); } catch (FileNotFoundException e) { throw new TransferFailedException(String.format("Cannot write file to '%s'", destination), e); } catch (IOException e) { throw new TransferFailedException(String.format("Cannot read from '%s' and write to '%s'", resourceName, destination), e); } finally { IoUtils.closeQuietly(in, out); } }
public boolean getIfNewer(String resourceName, File destination, long timestamp) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { try { SVNDirEntry e = queryRepo.info(combine(rootPath,resourceName), -1/*head*/); if( e.getDate().getTime() < timestamp ) return false; // older get(resourceName,destination); return true; } catch (SVNException e) { throw new ResourceDoesNotExistException("Unable to find "+resourceName+" in "+getRepository().getUrl(),e); } }
private void ftpChangeDirectory( Resource resource ) throws IOException, TransferFailedException, ResourceDoesNotExistException { if ( !ftp.changeWorkingDirectory( getRepository().getBasedir() ) ) { throw new ResourceDoesNotExistException( "Required directory: '" + getRepository().getBasedir() + "' " + "is missing" ); } String[] dirs = PathUtils.dirnames( resource.getName() ); for ( String dir : dirs ) { boolean dirChanged = ftp.changeWorkingDirectory( dir ); if ( !dirChanged ) { String msg = "Resource " + resource + " not found. Directory " + dir + " does not exist"; throw new ResourceDoesNotExistException( msg ); } } }
private void ftpChangeDirectory( Resource resource ) throws IOException, TransferFailedException, ResourceDoesNotExistException { if ( !ftp.changeWorkingDirectory( getRepository().getBasedir() ) ) { throw new ResourceDoesNotExistException( "Required directory: '" + getRepository().getBasedir() + "' " + "is missing" ); } String[] dirs = PathUtils.dirnames( resource.getName() ); for ( String dir : dirs ) { boolean dirChanged = ftp.changeWorkingDirectory( dir ); if ( !dirChanged ) { String msg = "Resource " + resource + " not found. Directory " + dir + " does not exist"; throw new ResourceDoesNotExistException( msg ); } } }
public void get(String resourceName, File destination) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { Resource res = new Resource( resourceName ); try { fireGetInitiated( res, destination ); fireGetStarted( res, destination ); Map m = new HashMap(); destination.getParentFile().mkdirs(); FileOutputStream fos = new FileOutputStream(destination); try { queryRepo.getFile(combine(rootPath,resourceName),-1/*head*/,m, fos); } finally { fos.close(); } postProcessListeners( res, destination, TransferEvent.REQUEST_GET ); fireGetCompleted( res, destination ); } catch (SVNException e) { throw new ResourceDoesNotExistException("Unable to find "+resourceName+" in "+getRepository().getUrl(),e); } catch (IOException e) { throw new TransferFailedException("Unable to find "+resourceName+" in "+getRepository().getUrl(),e); } }
@Override protected void putResource(File source, String destination, TransferProgress transferProgress) throws TransferFailedException, ResourceDoesNotExistException { String key = getKey(destination); InputStream in = null; try { ObjectMetadata objectMetadata = new ObjectMetadata(); objectMetadata.setContentLength(source.length()); objectMetadata.setContentType(Mimetypes.getInstance().getMimetype(source)); in = new TransferProgressFileInputStream(source, transferProgress); this.amazonS3.putObject(new PutObjectRequest(this.bucketName, key, in, objectMetadata)); } catch (AmazonServiceException e) { throw new TransferFailedException(String.format("Cannot write file to '%s'", destination), e); } catch (FileNotFoundException e) { throw new ResourceDoesNotExistException(String.format("Cannot read file from '%s'", source), e); } finally { IoUtils.closeQuietly(in); } }
@Override protected void putResource(File source, String destination, TransferProgress transferProgress) throws TransferFailedException, ResourceDoesNotExistException { String key = getKey(destination); mkdirs(key, 0); InputStream in = null; try { ObjectMetadata objectMetadata = new ObjectMetadata(); objectMetadata.setContentLength(source.length()); objectMetadata.setContentType(Mimetypes.getInstance().getMimetype(source)); in = new TransferProgressFileInputStream(source, transferProgress); this.amazonS3.putObject(new PutObjectRequest(this.bucketName, key, in, objectMetadata)); } catch (AmazonServiceException e) { throw new TransferFailedException(String.format("Cannot write file to '%s'", destination), e); } catch (FileNotFoundException e) { throw new ResourceDoesNotExistException(String.format("Cannot read file from '%s'", source), e); } finally { IoUtils.closeQuietly(in); } }
@Override protected void putResource(File source, String destination, TransferProgress transferProgress) throws TransferFailedException, ResourceDoesNotExistException { String key = getKey(destination); mkdirs(key, 0); InputStream in = null; try { ObjectMetadata objectMetadata = new ObjectMetadata(); objectMetadata.setContentLength(source.length()); objectMetadata.setContentType(Mimetypes.getInstance().getMimetype(source)); in = new TransferProgressFileInputStream(source, transferProgress); this.amazonS3.putObject(new PutObjectRequest(this.bucketName, key, in, objectMetadata)); } catch (AmazonServiceException e) { throw new TransferFailedException(String.format("Cannot write file to '%s'", destination), e); } catch (FileNotFoundException e) { throw new ResourceDoesNotExistException(String.format("Cannot read file from '%s'", source), e); } finally { IoUtils.closeQuietly(in); } }