@Override public TransferManager apply(TransferManagerParams params) { return new TransferManager(params); } };
/** * Returns a {@link TransferManager} for the given region, or throws an * exception when unable. The returned {@link TransferManager} will always * be instantiated from whatever {@link AmazonS3} is in the cache, * whether provided with {@link #useClient(AmazonS3)} or instantiated * automatically from {@link AWSCredentials}. * * Any {@link TransferManager} returned could be shut down if a new * underlying {@link AmazonS3} is provided with * {@link #useClient(AmazonS3)}. * * @param region * The region string the returned {@link TransferManager} will be * configured to use. * @return A transfer manager for the given region from the cache, or one * instantiated automatically from any existing * {@link AmazonS3}, */ public TransferManager getTransferManager(String region) { synchronized (transferManagersByRegion) { TransferManager tm = transferManagersByRegion.get(region); if (tm == null) { tm = new TransferManager(getClient(region)); transferManagersByRegion.put(region, tm); } return tm; } } }
public static void uploadDirWithSubprogress(String dir_path, String bucket_name, String key_prefix, boolean recursive, boolean pause) { System.out.println("directory: " + dir_path + (recursive ? " (recursive)" : "") + (pause ? " (pause)" : "")); TransferManager xfer_mgr = new TransferManager(); try { MultipleFileUpload multi_upload = xfer_mgr.uploadDirectory( bucket_name, key_prefix, new File(dir_path), recursive); // loop with Transfer.isDone() XferMgrProgress.showMultiUploadProgress(multi_upload); // or block with Transfer.waitForCompletion() XferMgrProgress.waitForCompletion(multi_upload); } catch (AmazonServiceException e) { System.err.println(e.getErrorMessage()); System.exit(1); } xfer_mgr.shutdownNow(); }
mManager = new TransferManager(client);
TransferManager tm = new TransferManager(awsCreds); Upload upload = tm.upload(existingBucketName, "/game/" + keyName + ".json", new File(path));
@Override public TransferManager apply(TransferManagerParams params) { return new TransferManager(params); } };
public S3Writer(String bucket, String keyPrefix, AmazonS3 s3Client) { this(bucket, keyPrefix, s3Client, new TransferManager(s3Client)); }
public S3Writer(String bucket, String keyPrefix, AmazonS3 s3Client) { this(bucket, keyPrefix, s3Client, new TransferManager(s3Client)); }
TRANSFERMANAGER_ACCESSKEY_MAP.put(clientOptions.getAccessKey(), new TransferManager(client));
public S3Storage(final Config config, AmazonS3Client client, String bucket) { checkArgument(!isNullOrEmpty(bucket), "bucket is null or empty"); this.config = config; this.client = client; this.bucket = bucket; this.uploadExecutor = Executors.newCachedThreadPool( new ThreadFactoryBuilder() .setNameFormat("storage-s3-upload-transfer-%d") .build()); this.transferManager = new TransferManager(client, uploadExecutor); // TODO check the existence of the bucket so that following // any GET or PUT don't get 404 Not Found error. }
public PrestoS3OutputStream(AmazonS3 s3, TransferManagerConfiguration config, String host, String key, File tempFile, boolean sseEnabled) throws IOException { super(new BufferedOutputStream(new FileOutputStream(requireNonNull(tempFile, "tempFile is null")))); transferManager = new TransferManager(requireNonNull(s3, "s3 is null")); transferManager.setConfiguration(requireNonNull(config, "config is null")); this.host = requireNonNull(host, "host is null"); this.key = requireNonNull(key, "key is null"); this.tempFile = tempFile; this.sseEnabled = sseEnabled; log.debug("OutputStream for key '%s' using file: %s", key, tempFile); }
@Override public void start() throws Exception { LOG.info("Starting {}.", name); ClientConfiguration clientConfiguration = new ClientConfiguration(); this.svc = new TransferManager(new AmazonS3Client(creds,clientConfiguration)); LOG.info("Started {}.", name); started = true; }
private TransferManager getS3TransferManager(BackupRestoreContext ctx) { final String accessKey = ctx.getAccountId(); final String secretKey = ctx.getSecretKey(); final BasicAWSCredentials basicAWSCredentials = new BasicAWSCredentials(accessKey, secretKey); TransferManager tx = new TransferManager(basicAWSCredentials); return tx; }
protected void init(Region region) { transferManager = new TransferManager(this); TransferManagerConfiguration configuration = new TransferManagerConfiguration(); configuration.setMultipartUploadThreshold(100 * Constants.KB); transferManager.setConfiguration(configuration); this.setRegion(region); }
private void initTransferManager() { TransferManagerConfiguration transferConfiguration = new TransferManagerConfiguration(); transferConfiguration.setMinimumUploadPartSize(partSize); transferConfiguration.setMultipartUploadThreshold(multiPartThreshold); transferConfiguration.setMultipartCopyPartSize(partSize); transferConfiguration.setMultipartCopyThreshold(multiPartThreshold); transfers = new TransferManager(s3, unboundedThreadPool); transfers.setConfiguration(transferConfiguration); }
@Override protected void connectToRepository(Repository source, AuthenticationInfo auth, ProxyInfo proxy) { AWSCredentials credentials = getCredentials(auth); this.client = getAmazonS3Client(credentials); this.transferManager = new TransferManager(credentials); this.bucketName = source.getHost(); validateBucket(client, bucketName); this.basedir = getBaseDir(source); // If they've specified <filePermissions> in settings.xml, that always wins CannedAccessControlList repoAcl = getAclFromRepository(source); if (repoAcl != null) { log.info("File permissions: " + repoAcl.name()); acl = repoAcl; } }
private void initTransferManager() { TransferManagerConfiguration transferConfiguration = new TransferManagerConfiguration(); transferConfiguration.setMinimumUploadPartSize(partSize); transferConfiguration.setMultipartUploadThreshold(multiPartThreshold); transferConfiguration.setMultipartCopyPartSize(partSize); transferConfiguration.setMultipartCopyThreshold(multiPartThreshold); transfers = new TransferManager(mClient, unboundedThreadPool); transfers.setConfiguration(transferConfiguration); }
private void initTransferManager() { TransferManagerConfiguration transferConfiguration = new TransferManagerConfiguration(); transferConfiguration.setMinimumUploadPartSize(partSize); transferConfiguration.setMultipartUploadThreshold(multiPartThreshold); transferConfiguration.setMultipartCopyPartSize(partSize); transferConfiguration.setMultipartCopyThreshold(multiPartThreshold); transfers = new TransferManager(mClient, unboundedThreadPool); transfers.setConfiguration(transferConfiguration); }
s3TransferManager = new TransferManager(s3); //uses separate pool, for multipart zip upload s3TransferManager.setConfiguration(tmConfig);
public AwsGatlingRunner(final String endpoint) { final AWSCredentialsProviderChain credentials = new AWSCredentialsProviderChain( new PropertiesFileCredentialsProvider("aws.properties"), new EnvironmentVariableCredentialsProvider(), new SystemPropertiesCredentialsProvider(), new ProfileCredentialsProvider(), new InstanceProfileCredentialsProvider()); this.ec2client = new AmazonEC2Client(credentials); this.ec2client.setEndpoint(endpoint); this.transferManager = new TransferManager(credentials); }